liberator icon indicating copy to clipboard operation
liberator copied to clipboard

Internally doesn't throw exception

Open siscia opened this issue 11 years ago • 4 comments

Hi,

I lost a solid hour try to debuging a trivial problem.

Basically I was returrning a map with unique key was :resource I guess that such map was combined with the context and when liberator try to access a field like (-> ctx :resource :whatever) it blowed up because (ctx :resource) wasn't a map anymore.

It was weird because I couldn't get the exception, it just said "500 Internal Error" and didn't throw any exception.

Why Liberator didn't throw any exception ? It is the desired behaviour ? If not how we can fix that ?

Greets

siscia avatar Dec 13 '14 06:12 siscia

Which version are you using? There was a regression in version 0.12.0 that caused this behaviour. For me it was fixed by 0.12.2.

[1] https://github.com/clojure-liberator/liberator/commit/b119c9e527dcb9c1c4130c85089848099b66d9a6

andrewmcveigh avatar Dec 13 '14 09:12 andrewmcveigh

I use the last version, 0.12.2

It works perfectly if my code throw exception.

If I write a :post! and the function throw an exception it works as expected.

The problem is when is lberator itself at throw an exception.

Please see the pull request attached :)

siscia avatar Dec 14 '14 02:12 siscia

Thanks for the report and the PR. Could you please cleanup the PR, remove up-versioning etc?). would the test case be more precise if you'd remove the thrown exception in :exists?. As far as I understand you're point to the error triggered by altering :resource in :service-available?, right?

ordnungswidrig avatar Feb 09 '15 15:02 ordnungswidrig

Hi,

Sorry, I explained extremely badly the problem.

It will take a while, but as soon as I get home (3 weeks) I will do my best to provide a better explanation and a more helpful pull request.

If anybody, in the meantime want to work on the problem is extremely welcome ;)

siscia avatar Feb 12 '15 22:02 siscia