File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed
Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -149,7 +149,7 @@ class LangModule extends AbstractModule {
149149 if ( typeof lang !== 'string' ) {
150150 lang = this . getConfig ( 'defaultLang' )
151151 }
152- if ( key . constructor . name === 'AdaptError' ) {
152+ if ( key . constructor . name . endsWith ( 'Error' ) ) {
153153 return this . translateError ( lang , key )
154154 }
155155 const s = this . phrases [ lang ] [ key ]
@@ -183,7 +183,7 @@ class LangModule extends AbstractModule {
183183 * @returns The translated error (if passed error is not an instance of AdaptError, the original value will be returned)
184184 */
185185 translateError ( lang , error ) {
186- return error ? .constructor ? .name === 'AdaptError' ? this . translate ( lang , `error.${ error . code } ` , error . data ) : error
186+ return error . constructor . name . endsWith ( 'Error' ) ? this . translate ( lang , `error.${ error . code } ` , error . data ?? error ) : error
187187 }
188188}
189189
You can’t perform that action at this time.
0 commit comments