Browse Source

Return a 404 instead of a 500 if a resource is unavailable.

Could be improved in the future to return different codes depending on its status (e.g. doesn't exist = 404, 102 for loading, 500 for error, etc), but 404 makes the most sense until that has been developed
qdn
CalDescent 3 years ago
parent
commit
f3e9dfe734
  1. 2
      src/main/java/org/qortal/api/resource/ArbitraryResource.java

2
src/main/java/org/qortal/api/resource/ArbitraryResource.java

@ -641,7 +641,7 @@ public class ArbitraryResource {
return response; return response;
} catch (Exception e) { } catch (Exception e) {
LOGGER.info(String.format("Unable to load %s %s: %s", service, name, e.getMessage())); LOGGER.info(String.format("Unable to load %s %s: %s", service, name, e.getMessage()));
throw ApiExceptionFactory.INSTANCE.createCustomException(request, ApiError.REPOSITORY_ISSUE, e.getMessage()); throw ApiExceptionFactory.INSTANCE.createCustomException(request, ApiError.FILE_NOT_FOUND, e.getMessage());
} }
} }

Loading…
Cancel
Save