How do you know if a save or load operation has failed?
How do you know if a save or load operation has failed?
How do we programmatically check during runtime whether a data save or load operation has failed? There are no success or failure results in your API. There are no exceptions being thrown either by the API (unless something crashes internally).
Re: How do you know if a save or load operation has failed?
Hi there,
Exceptions are thrown when something goes wrong, so you can use it in a try/catch block (for example, a FileNotFoundException will be thrown when data is missing).
If exceptions are not being thrown for you, make sure you have exceptions enabled in your Unity project settings.
All the best,
Joel
Exceptions are thrown when something goes wrong, so you can use it in a try/catch block (for example, a FileNotFoundException will be thrown when data is missing).
If exceptions are not being thrown for you, make sure you have exceptions enabled in your Unity project settings.
All the best,
Joel
Re: How do you know if a save or load operation has failed?
My bad, exceptions ARE being thrown. Thanks.
Re: How do you know if a save or load operation has failed?
Sorry about the back n forth on this. Further testing reveals there are a couple of places that are missing exceptions or error handling:
1) When you read a tag (using ES2Reader) into an incompatible type, we are only given an error in the console. This is limiting when you want to programmatically check for this situation.
2) When you read a non-existent tag (using ES2Reader) we are given an error in the console. Sure we can check for Exists prior to that, but there are situations where a try catch would be more elegant.
Generally it seems that exceptions are not being generated uniformly across the API or am I missing something here?
Thanks.
1) When you read a tag (using ES2Reader) into an incompatible type, we are only given an error in the console. This is limiting when you want to programmatically check for this situation.
2) When you read a non-existent tag (using ES2Reader) we are given an error in the console. Sure we can check for Exists prior to that, but there are situations where a try catch would be more elegant.
Generally it seems that exceptions are not being generated uniformly across the API or am I missing something here?
Thanks.
Re: How do you know if a save or load operation has failed?
Hi there,
There are certain areas where we intentionally don't throw exceptions (especially where ES2Reader/Writer is concerned) because it's an error which should not occur at runtime.
If you wish, you can modify the code to replace the Debug.Log with an exception yourself.
Note that Easy Save 3 (which is currently in beta) throws exceptions for almost everything as we've structured it differently, so certain errors are now recoverable.
All the best,
Joel
There are certain areas where we intentionally don't throw exceptions (especially where ES2Reader/Writer is concerned) because it's an error which should not occur at runtime.
If you wish, you can modify the code to replace the Debug.Log with an exception yourself.
Note that Easy Save 3 (which is currently in beta) throws exceptions for almost everything as we've structured it differently, so certain errors are now recoverable.
All the best,
Joel