Skip to content

Commit

Permalink
fix: pr comments
Browse files Browse the repository at this point in the history
  • Loading branch information
sattvikc committed Nov 3, 2023
1 parent 0beb42c commit fc45766
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/main/java/io/supertokens/webserver/RequestStats.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ public static RequestStats getInstance(Main main, AppIdentifier appIdentifier) t
return (RequestStats) main.getResourceDistributor()
.getResource(appIdentifier.getAsPublicTenantIdentifier(), RESOURCE_KEY);
} catch (TenantOrAppNotFoundException e) {
// appIdentifier parameter is coming from the API request and hence we need to check if the app exists
// before creating a resource for it
if (Multitenancy.getTenantInfo(main, appIdentifier.getAsPublicTenantIdentifier()) == null) {
throw e;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/supertokens/webserver/WebserverAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ protected void service(HttpServletRequest req, HttpServletResponse resp) throws
try {
RequestStats.getInstance(main, tenantIdentifier.toAppIdentifier()).updateRequestStats();
} catch (TenantOrAppNotFoundException e) {
throw new IllegalStateException(e); // should never happen
// Ignore the error as we would have already sent the response for tenantNotFound
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/test/java/io/supertokens/test/RequestStatsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,8 @@ public void testWithNonExistantApp() throws Exception {
1000, null, Utils.getCdiVersionStringLatestForTests(), null);
fail();
} catch (HttpResponseException e) {
assertEquals(500, e.statusCode);
assertEquals("Http error. Status Code: 500. Message: AppId or tenantId not found => Tenant with the following connectionURIDomain, appId and tenantId combination not found: (, a1, public)", e.getMessage());
assertEquals(400, e.statusCode);
assertEquals("Http error. Status Code: 400. Message: AppId or tenantId not found => Tenant with the following connectionURIDomain, appId and tenantId combination not found: (, a1, public)", e.getMessage());
}

process.kill();
Expand Down

0 comments on commit fc45766

Please sign in to comment.