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

Fix ImageSource loading error message #2049

Closed
eonarheim opened this issue Oct 1, 2021 · 2 comments · Fixed by #2052
Closed

Fix ImageSource loading error message #2049

eonarheim opened this issue Oct 1, 2021 · 2 comments · Fixed by #2052
Labels
community in-progress This issue is marked in-progress. This label will be removed if there is no activity for 30 days. Hacktoberfest Issues marked for the community Hacktoberfest event https://hacktoberfest.digitalocean.com/

Comments

@eonarheim
Copy link
Member

Context

Currently when an ImageSource fails loading for whatever reason it gives a confusing error message 'Error loading texture'

image

Proposal

In the section of code we should give more context to the user about what failed to load with the path, and we should present the error from the exception to the console.

  1. This error message should read Error loading ImageSource from path './path/to/image/img.png' with error [some error message from the exception]
  2. New unit tests confirming this message on error
@eonarheim eonarheim added the Hacktoberfest Issues marked for the community Hacktoberfest event https://hacktoberfest.digitalocean.com/ label Oct 1, 2021
@nidble
Copy link
Contributor

nidble commented Oct 2, 2021

Hi @eonarheim, can I work on this?

@eonarheim
Copy link
Member Author

@nidble all yours!

@eonarheim eonarheim added the community in-progress This issue is marked in-progress. This label will be removed if there is no activity for 30 days. label Oct 2, 2021
nidble pushed a commit to nidble/Excalibur that referenced this issue Oct 4, 2021
eonarheim pushed a commit that referenced this issue Oct 4, 2021
Co-authored-by: Antonino Bertulla <antonino.bertulla@beefree.io>

Closes #2049

## Changes:

- Improve ImageSource error with specific information
- Wrap the previous error [object](https://github.com/excaliburjs/Excalibur/blob/main/src/engine/Resources/Resource.ts#L68), with a generic `Error` to enhance error handling
- Provide a syntax more lightweight when dealing with [error propagation](https://github.com/excaliburjs/Excalibur/blob/main/src/engine/Graphics/ImageSource.ts#L86)
- Add new test case
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community in-progress This issue is marked in-progress. This label will be removed if there is no activity for 30 days. Hacktoberfest Issues marked for the community Hacktoberfest event https://hacktoberfest.digitalocean.com/
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants