Skip to content

Commit

Permalink
fix: 500 error message
Browse files Browse the repository at this point in the history
  • Loading branch information
sattvikc committed Nov 12, 2024
1 parent f9dea95 commit ee54423
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [9.3.1]

- Includes exception class name in 500 error message

## [9.3.0]

### Changes
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ compileTestJava { options.encoding = "UTF-8" }
// }
//}

version = "9.3.0"
version = "9.3.1"


repositories {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/io/supertokens/webserver/WebserverAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -532,10 +532,10 @@ protected void service(HttpServletRequest req, HttpServletResponse resp) throws
} else if (rootCause instanceof BadPermissionException) {
sendTextResponse(403, rootCause.getMessage(), resp);
} else {
sendTextResponse(500, rootCause.getMessage(), resp);
sendTextResponse(500, rootCause.toString(), resp);
}
} else {
sendTextResponse(500, e.getMessage(), resp);
sendTextResponse(500, e.toString(), resp);
}
}
Logging.info(main, tenantIdentifier, "API ended: " + req.getRequestURI() + ". Method: " + req.getMethod(),
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/io/supertokens/test/PathRouterTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ protected void doGet(HttpServletRequest req, HttpServletResponse resp)
fail();
} catch (HttpResponseException e) {
assertEquals(500, e.statusCode);
assertEquals("Http error. Status Code: 500. Message: Test Exception", e.getMessage());
assertEquals("Http error. Status Code: 500. Message: java.lang.RuntimeException: Test Exception", e.getMessage());
}
}

Expand All @@ -137,7 +137,7 @@ protected void doGet(HttpServletRequest req, HttpServletResponse resp)
fail();
} catch (HttpResponseException e) {
assertEquals(500, e.statusCode);
assertEquals("Http error. Status Code: 500. Message: Runtime Exception", e.getMessage());
assertEquals("Http error. Status Code: 500. Message: java.lang.RuntimeException: Runtime Exception", e.getMessage());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ public void testImportingAUsesrFromFirebaseWithoutSettingTheSignerKey() throws E
throw new Exception("Should not come here");
} catch (io.supertokens.test.httpRequest.HttpResponseException e) {
assertTrue(e.statusCode == 500
&& e.getMessage().equals("Http error. Status Code: 500. Message: 'firebase_password_hashing_signer_key' cannot be null"));
&& e.getMessage().equals("Http error. Status Code: 500. Message: java.lang.IllegalStateException: 'firebase_password_hashing_signer_key' cannot be null"));
}

process.kill();
Expand Down Expand Up @@ -388,7 +388,7 @@ public void testSigningInAUserWithFirebasePasswordHashWithoutSettingTheSignerKey
throw new Exception("Should not come here");
} catch (io.supertokens.test.httpRequest.HttpResponseException e) {
assertTrue(e.statusCode == 500
&& e.getMessage().equals("Http error. Status Code: 500. Message: 'firebase_password_hashing_signer_key' cannot be null"));
&& e.getMessage().equals("Http error. Status Code: 500. Message: java.lang.IllegalStateException: 'firebase_password_hashing_signer_key' cannot be null"));
}

process.kill();
Expand Down

0 comments on commit ee54423

Please sign in to comment.