File tree 2 files changed +13
-5
lines changed
2 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -52,10 +52,18 @@ function onGetDetailsInit(state, action) {
52
52
function onGetDetailsDone ( state , action ) {
53
53
if ( action . error ) {
54
54
logger . error ( 'Failed to get challenge details!' , action . payload ) ;
55
- fireErrorMessage (
56
- 'ERROR: Failed to load the challenge' ,
57
- 'Please, try again a bit later' ,
58
- ) ;
55
+ if ( action . payload . message === 'Forbidden' ) {
56
+ fireErrorMessage (
57
+ 'ERROR: Private challenge' ,
58
+ 'This challenge is only available to those in a private group.'
59
+ + ' It looks like you do not have access to this challenge.' ,
60
+ ) ;
61
+ } else {
62
+ fireErrorMessage (
63
+ 'ERROR: Failed to load the challenge' ,
64
+ 'Please, try again a bit later' ,
65
+ ) ;
66
+ }
59
67
return {
60
68
...state ,
61
69
fetchChallengeFailure : action . error ,
Original file line number Diff line number Diff line change @@ -138,7 +138,7 @@ async function checkErrorV5(res) {
138
138
if ( res . status >= 500 ) {
139
139
setErrorIcon ( ERROR_ICON_TYPES . API , '/challenges' , res . statusText ) ;
140
140
}
141
- throw new Error ( res . statusText ) ;
141
+ throw new Error ( ( ! res . statusText && res . status === 403 ) ? 'Forbidden' : res . statusText ) ;
142
142
}
143
143
const jsonRes = ( await res . json ( ) ) ;
144
144
if ( jsonRes . message ) {
You can’t perform that action at this time.
0 commit comments