File tree Expand file tree Collapse file tree 3 files changed +6
-5
lines changed
Expand file tree Collapse file tree 3 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ module.exports = async (ctx, next) => {
1919 ctx . state . processMesId
2020 ) ;
2121 }
22- ctx . reply ( e . toString ( ) ) ;
22+ ctx . reply ( e . toString ( lang ) ) ;
2323 } else throw e ;
2424 }
2525} ;
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ module.exports = async (ctx, next) => {
1414 await next ( ) ;
1515 } else {
1616 try {
17- const res = await got . get ( url ) ;
17+ const res = await got ( url ) ;
1818 ctx . state . feedUrl = decodeURI ( res . url ) ; // handle redirect
1919 feed = await feedUtil . isFeedValid ( res . body ) ;
2020 if ( ! feed ) {
@@ -31,6 +31,7 @@ module.exports = async (ctx, next) => {
3131 feed = await parser . parseString ( res . body ) ;
3232 delete feed . items ;
3333 ctx . state . feed = feed ;
34+ ctx . state . feedUrl = ctx . state . feedUrl [ 0 ] ;
3435 await next ( ) ; // next
3536 break ;
3637 default :
Original file line number Diff line number Diff line change @@ -9,14 +9,14 @@ class ControllableError extends Error {
99 }
1010 }
1111
12- toString ( ) {
13- return i18n [ this . code ] ;
12+ toString ( lang ) {
13+ return i18n [ lang ] [ this . code ] ;
1414 }
1515}
1616
1717exports . newCtrlErr = function ( code , e ) {
1818 const err = new ControllableError ( e ) ;
19- if ( e . response ) {
19+ if ( e && e . response ) {
2020 switch ( e . response . statusCode ) {
2121 case 404 :
2222 case 403 :
You can’t perform that action at this time.
0 commit comments