@@ -96,7 +96,7 @@ public void prefetchConfiguration(
9696 isPrefetched = true ;
9797 fetchConfigurationLatch .countDown ();
9898 } catch (Exception e ) {
99- promise .reject ("RNAppAuth Error " , "Failed to convert serviceConfiguration" , e );
99+ promise .reject ("configuration_error " , "Failed to convert serviceConfiguration" , e );
100100 }
101101 } else if (mServiceConfiguration .get () == null ) {
102102 final Uri issuerUri = Uri .parse (issuer );
@@ -107,7 +107,7 @@ public void onFetchConfigurationCompleted(
107107 @ Nullable AuthorizationServiceConfiguration fetchedConfiguration ,
108108 @ Nullable AuthorizationException ex ) {
109109 if (ex != null ) {
110- promise .reject ("RNAppAuth Error " , "Failed to fetch configuration" , ex );
110+ promise .reject ("service_configuration_fetch_error " , "Failed to fetch configuration" , ex );
111111 return ;
112112 }
113113 mServiceConfiguration .set (fetchedConfiguration );
@@ -126,7 +126,7 @@ public void onFetchConfigurationCompleted(
126126 fetchConfigurationLatch .await ();
127127 promise .resolve (isPrefetched );
128128 } catch (Exception e ) {
129- promise .reject ("RNAppAuth Error " , "Failed to await fetch configuration" , e );
129+ promise .reject ("service_configuration_fetch_error " , "Failed to await fetch configuration" , e );
130130 }
131131 }
132132
@@ -175,7 +175,7 @@ public void authorize(
175175 additionalParametersMap
176176 );
177177 } catch (Exception e ) {
178- promise .reject ("Failed to authenticate " , e .getMessage ());
178+ promise .reject ("authentication_failed " , e .getMessage ());
179179 }
180180 } else {
181181 final Uri issuerUri = Uri .parse (issuer );
@@ -186,7 +186,7 @@ public void onFetchConfigurationCompleted(
186186 @ Nullable AuthorizationServiceConfiguration fetchedConfiguration ,
187187 @ Nullable AuthorizationException ex ) {
188188 if (ex != null ) {
189- promise .reject ("Failed to fetch configuration " , getErrorMessage (ex ));
189+ promise .reject ("service_configuration_fetch_error " , getErrorMessage (ex ));
190190 return ;
191191 }
192192
@@ -257,7 +257,7 @@ public void refresh(
257257 promise
258258 );
259259 } catch (Exception e ) {
260- promise .reject ("Failed to refresh token " , e .getMessage ());
260+ promise .reject ("token_refresh_failed " , e .getMessage ());
261261 }
262262 } else {
263263 final Uri issuerUri = Uri .parse (issuer );
@@ -268,7 +268,7 @@ public void onFetchConfigurationCompleted(
268268 @ Nullable AuthorizationServiceConfiguration fetchedConfiguration ,
269269 @ Nullable AuthorizationException ex ) {
270270 if (ex != null ) {
271- promise .reject ("Failed to fetch configuration " , getErrorMessage (ex ));
271+ promise .reject ("service_configuration_fetch_error " , getErrorMessage (ex ));
272272 return ;
273273 }
274274
@@ -300,14 +300,14 @@ public void onFetchConfigurationCompleted(
300300 public void onActivityResult (Activity activity , int requestCode , int resultCode , Intent data ) {
301301 if (requestCode == 0 ) {
302302 if (data == null ) {
303- promise .reject ("Failed to authenticate " , "Data intent is null" );
303+ promise .reject ("authentication_error " , "Data intent is null" );
304304 return ;
305305 }
306-
306+
307307 final AuthorizationResponse response = AuthorizationResponse .fromIntent (data );
308308 AuthorizationException exception = AuthorizationException .fromIntent (data );
309309 if (exception != null ) {
310- promise .reject ("Failed to authenticate " , getErrorMessage (exception ));
310+ promise .reject ("authentication_error " , getErrorMessage (exception ));
311311 return ;
312312 }
313313
@@ -329,7 +329,7 @@ public void onTokenRequestCompleted(
329329 WritableMap map = TokenResponseFactory .tokenResponseToMap (resp , response );
330330 authorizePromise .resolve (map );
331331 } else {
332- promise .reject ("Failed exchange token " , getErrorMessage (ex ));
332+ promise .reject ("token_exchange_failed " , getErrorMessage (ex ));
333333 }
334334 }
335335 };
@@ -468,7 +468,7 @@ public void onTokenRequestCompleted(@Nullable TokenResponse response, @Nullable
468468 WritableMap map = TokenResponseFactory .tokenResponseToMap (response );
469469 promise .resolve (map );
470470 } else {
471- promise .reject ("Failed to refresh token " , getErrorMessage (ex ));
471+ promise .reject ("token_refresh_failed " , getErrorMessage (ex ));
472472 }
473473 }
474474 };
0 commit comments