abraemer / StartupCustomizer.jl

Easy customization of startup.jl from the REPL!
MIT License
11 stars 0 forks source link

Increase robustness #7

Open abraemer opened 1 year ago

abraemer commented 1 year ago

Right now this package is not very robust: Exceptions during writing a module leaves the startup.jl in a bad state, that does not work correctly and can't be parsed anymore. We should do:

Alseidon commented 1 year ago

A problem I found while using the package: add failed to add the code for a package, but still added the first line. So startup.jl now contains the starting line for one module, but nothing else.

This leads to errors by _parse_startup_file : as you do not check whether modules_starts and modules_ends have the same length, atline = module_ends[atmodule]+1 fails (because atmodule has a value of 1 and module_ends is empty.

I realize a fully robust parser would need to do more that check the two above lengths are equal, but this would improve a startup.jl state which the package itself generated.