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

Exception on reading a value from cell with error #27

Open
nidu opened this issue Oct 13, 2014 · 2 comments
Open

Exception on reading a value from cell with error #27

nidu opened this issue Oct 13, 2014 · 2 comments

Comments

@nidu
Copy link
Contributor

nidu commented Oct 13, 2014

Hello. When i'm reading a value from a cell with an error using read-cell i get the following exception:

IllegalArgumentException No method in multimethod 'read-cell-value' for dispatch value: 5  
clojure.lang.MultiFn.getFn (MultiFn.java:160)

Apparently that's because read-cell-value doesn't handle Cell/CELL_TYPE_ERROR. Is it a bug or should i treat erroneous cells differently?

@mjul
Copy link
Owner

mjul commented Oct 13, 2014

Various people have mentioned error cell handling in previous issues and pull requests (e.g. pull request #11). Some people want the errors ignored, other want them replaced by a symbol and other clients may have yet other needs.

So, until now I preferred to just let the errors bubble up to the application.

If you can think of a way to provide pluggable error-handling strategies (for example to silent return error cells as blank, nil or :error) I would be happy to accept a pull request.

Maybe it can be done inside the existing multi-method design.

Another possibility is to move towards more of a state-machine approach so the POI object that is passed to the docjure functions is wrapped in a Clojure data structure which could then also include error handling strategies as higher-order function(s).

For a 2.0 release I prefer the latter, as it would also provide a good basis for making the text formatting stuff less imperative and more functional.

How do you propose to solve it?

@nidu
Copy link
Contributor Author

nidu commented Oct 13, 2014

It looks like it really can be done in multi-method design by just adding a handler for Cell/CELL_TYPE_ERROR. What about returning some kind of record with brief error info? It won't overlap with other cell types. Returning :error or nil can be not enough for a particular task if read-cell aims to satisfy all reading needs.

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

No branches or pull requests

2 participants