File tree 2 files changed +13
-2
lines changed 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -10,10 +10,11 @@ export default class CrateRoute extends Route {
10
10
} catch ( error ) {
11
11
if ( error . errors ?. some ( e => e . detail === 'Not Found' ) ) {
12
12
this . notifications . error ( `Crate '${ params . crate_id } ' does not exist` ) ;
13
- this . replaceWith ( 'index' ) ;
14
13
} else {
15
- throw error ;
14
+ this . notifications . error ( `Loading data for the ' ${ params . crate_id } ' crate failed. Please try again later!` ) ;
16
15
}
16
+
17
+ this . replaceWith ( 'index' ) ;
17
18
}
18
19
}
19
20
Original file line number Diff line number Diff line change @@ -87,6 +87,16 @@ module('Acceptance | crate page', function (hooks) {
87
87
assert . dom ( '[data-test-notification-message]' ) . hasText ( "Crate 'nanomsg' does not exist" ) ;
88
88
} ) ;
89
89
90
+ test ( 'other crate loading error shows an error message' , async function ( assert ) {
91
+ this . server . get ( '/api/v1/crates/:crate_name' , { } , 500 ) ;
92
+
93
+ await visit ( '/crates/nanomsg' ) ;
94
+ assert . equal ( currentURL ( ) , '/' ) ;
95
+ assert
96
+ . dom ( '[data-test-notification-message]' )
97
+ . hasText ( "Loading data for the 'nanomsg' crate failed. Please try again later!" ) ;
98
+ } ) ;
99
+
90
100
test ( 'unknown versions fall back to latest version and show an error message' , async function ( assert ) {
91
101
this . server . create ( 'crate' , { name : 'nanomsg' } ) ;
92
102
this . server . create ( 'version' , { crateId : 'nanomsg' , num : '0.6.0' } ) ;
You can’t perform that action at this time.
0 commit comments