SSHOC / sshoc-marketplace-backend

Code for the backend
Apache License 2.0
2 stars 0 forks source link

Actors history gives a 500 #372

Closed KlausIllmayer closed 1 year ago

KlausIllmayer commented 1 year ago

Calling /api/actors/{id}/history delivers an error 500, e.g. try out https://marketplace-api.sshopencloud.eu/api/actors/2235/history Not sure, if it is because this actor does not have a history or if it is a general issue, at least it should be no 500 error returned. In the logfiles it says:

ERROR e.s.m.c.MarketplaceExceptionHandler.handleServerError - Runtime exception
java.lang.NullPointerException: null
    at eu.sshopencloud.marketplace.services.actors.ActorHistoryService.findHistory(ActorHistoryService.java:49)
    at eu.sshopencloud.marketplace.services.actors.ActorHistoryService$$FastClassBySpringCGLIB$$14818f06.invoke(<generated>)
   ...

This endpoint could become necessary for the actor merging workflow.

KlausIllmayer commented 1 year ago

Works as it does not give back anymore a 500 status code. Still I like to re-open this issue, as in my opinion when there are no results it should give back a 404 status code. Currently, it gives back an empty error: [] This does not have any priority, but it sounds to me more consistent. @tparkola if you not agree, please close the issue.

tparkola commented 1 year ago

The bahavior in my opinion is OK because the history is empty. If we would say 404 then it could be confusing, e.g. one would interpret that there is no history (at all) of this actor in the system. In addition class 400 is about errors (client errors), which is not true in this case, i.e. the request is correct, we just don't have data, so empty list is returned. Hence, I close the issue.