-
Notifications
You must be signed in to change notification settings - Fork 1
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
Non-obvious Julia errors #92
Comments
One error that is not obvious (and can presumably be improved upon) happens when a modeler doesn't declare a single-variable tuple properly, eg typing :
instead of :
[ERROR: MethodError: no method matching merge(::Float64, ::@NamedTuple{g::Float64}) Closest candidates are: Stacktrace: This specific error is on the modeler side, but the user might encounter such problems when declaring statuses, or global simulation outputs. It seems at the very least worth documenting. |
#77 also relates to an unintuitive error for the user Here's another one which could be slightly improved upon : If there is a need to collect variables at two different scales, and one scale is completely absent from the mapping, the error occurs on the Julia side :
Exception has occurred: KeyError |
Another non-intuitive error : If a user declares inputs or outputs as empty The correct way of declaring an empty set of inputs or outputs is |
A small improvement : no output provided in multi scale leads to an error reported by Julia. It should really be an error with a description we provide. Or there should be an intuitive default behaviour (returning all variables ? Seems like a natural approach and convenient for the user, but might warrant a warning when the output data could be huge). |
I've a new one, quite specific to PSE:
Might need to rename a function or kwarg to prevent that kind of silent conflict from happening. Edit : On closer inspection, it seems like the way this specific error manifests is not so straightforward to make for a beginner. It might occur when they transition from modellist to multiscale modelling. The kwarg error might manifest itself differently otherwise. Edit (January 2025) : There is an example in test-mapping.jl that makes it easy to cause the error :
Renaming |
Another error that results in puzzling output for a beginner would be supplying an arg parameter as a kwarg in one of the run! functions, causing some confusing errors. |
Here's another one that might befuddle occasional users :
Closest candidates are: referring to the next kwarg Unless one guesses/knows that a kwarg might be missing one can't infer the cause of the error without an API lookup. |
If one puts a parenthesis in the wrong spot when defining a mapping, some non-obvious Julia errors can pop up :
which occurs when
is accidentally typed as
|
If PlantSimEngine is intended for use by non-programmers, or people with very little background in Julia, it might be worth adding some specific pages to the documentation that help novices quickly identify common sources of errors, or learn about specific quirks of the language that might be non-obvious pitfalls, that PlantSimEngine usage makes more likely to encounter.
Perhaps examples of errors that could be worth clarifying, documenting or anticipating could be added to this issue in the future.
The text was updated successfully, but these errors were encountered: