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

Loaders should return log #291

Closed
lpatiny opened this issue Oct 29, 2022 · 7 comments
Closed

Loaders should return log #291

lpatiny opened this issue Oct 29, 2022 · 7 comments
Labels
enhancement New feature or request

Comments

@lpatiny
Copy link
Contributor

lpatiny commented Oct 29, 2022

We have currently an issue tracking errors during data loading. This is the case in this project as well as in NMRium.

For each loader we should be able to return information about what they did.

I would suggest that the loader returns a structure like

{
  data: {} // the result of the parsing, in this case 'Measurements'
  logs: [{
     kind: 'error' | 'warning' | 'info' | 'debug',
     loader: 'NetCDF parser',
     message: 'The CDF is corrupted',
     relativePath: 'data/test/file.cdf',
     error: new Error('ab'),
  }]
}

@stropitek @targos What do you think ?

@jobo322 this is related to your current issue in nmr-load-save.

@targos
Copy link
Member

targos commented Oct 30, 2022

We need something, but what you propose doesn't seem useful because we don't know which file has a problem.

@lpatiny
Copy link
Contributor Author

lpatiny commented Oct 30, 2022

I amended my issue to add the new property relativePath. This relativePath could be a link to a folder in case we try to parse a bruker file that contains soo many levels or just the path to a specific file like jcamp or netcdf.

WDYT ?

@stropitek
Copy link
Contributor

Is the goal of this to show a helpful message to the user, or to be able to debug what is happening when files are loaded?

@lpatiny lpatiny assigned ghost Nov 4, 2022
@lpatiny lpatiny added enhancement New feature or request and removed discuss labels Nov 4, 2022
@lpatiny
Copy link
Contributor Author

lpatiny commented Nov 4, 2022

In the specific case of convert-biologic you should add in the loader a try / catch so that it does not crash and for each file add an entry in the log, either 'error' if failed or 'info' if success.

@ghost
Copy link

ghost commented Nov 4, 2022

The converter already throws internally when the file is not supported.

For the error that the parser throws I'll catch it and log a warning if that is preferred @lpatiny

The other error that I see in most parsers disappears if the crossHairAnnot is commented out.

@lpatiny
Copy link
Contributor Author

lpatiny commented Nov 5, 2022

It is expected that the converters (parsers) throws and this should not be changed.

Those errors (converter throws) should be catch during the loading. We could decide that for now the logs of all the loaders are just 'console.log' but we need to think about a feedback to the user in the future and design a component for this purpose.

I'm thinking that adding the property 'error' that contains the error that is catched could also help us to debug in the future what went wrong. You could then display error.stack for advanced users (like us).

@lpatiny
Copy link
Contributor Author

lpatiny commented Aug 8, 2023

This issue can now be solved using fifo-logger and showing the errors is related to:

@stropitek stropitek unassigned ghost Mar 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants