Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exceptions extend Error #413

Closed
wants to merge 1 commit into from
Closed

Exceptions extend Error #413

wants to merge 1 commit into from

Conversation

attekemppila
Copy link

@attekemppila attekemppila commented Aug 12, 2020

I'm currently using jsts 2.2.2. There "java" Exceptions extend js Error:

https://github.com/bjornharrtell/jsts/blob/2.2.2/src/org/locationtech/jts/geom/TopologyException.js
https://github.com/bjornharrtell/jsts/blob/2.2.2/src/java/lang/RuntimeException.js

This was changed in 2ac1660 , so that "java" Exceptions no longer extended js Error. (Why?)

https://github.com/bjornharrtell/jsts/blob/2.5.0/src/org/locationtech/jts/geom/TopologyException.js
https://github.com/bjornharrtell/jsts/blob/2.5.0/src/java/lang/RuntimeException.js
https://github.com/bjornharrtell/jsts/blob/2.5.0/src/java/lang/Exception.js

This pr adds back extending js Error. (Based on this: https://javascript.info/custom-errors)

Not that I want to catch jsts Exceptions outside jsts. It's just when they extend Error, they behave better, more js error-like: better error message, stacktrace, instanceof Error, etc.

@codecov
Copy link

codecov bot commented Aug 12, 2020

Codecov Report

Merging #413 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #413   +/-   ##
=======================================
  Coverage   63.91%   63.91%           
=======================================
  Files         256      256           
  Lines       13872    13873    +1     
=======================================
+ Hits         8866     8867    +1     
  Misses       5006     5006           
Impacted Files Coverage Δ
src/java/lang/Exception.js 66.66% <100.00%> (+16.66%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ba89299...ca4a3f7. Read the comment docs.

@bjornharrtell
Copy link
Owner

Thanks for reporting. I think it was removed without much thought and it probably make sense to restore it.

@bjornharrtell
Copy link
Owner

Replaced by f7f47ab and released as 2.5.1. Let me know if it doesn't work as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants