diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2022-05-12 00:21:52 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2022-05-12 00:21:52 -0400 |
commit | a9cadc7f32fd9fd244fc3e22c62a35e7c257c084 (patch) | |
tree | d07a8b34608f46948505755a599c07da65a7fde7 /src/SMAPI/Framework/Exceptions | |
parent | 09f69d986f4f44521d8a2cd745269dce4b83320e (diff) | |
parent | e943ae84136d46432e04e577041850d2aa7db43e (diff) | |
download | SMAPI-a9cadc7f32fd9fd244fc3e22c62a35e7c257c084.tar.gz SMAPI-a9cadc7f32fd9fd244fc3e22c62a35e7c257c084.tar.bz2 SMAPI-a9cadc7f32fd9fd244fc3e22c62a35e7c257c084.zip |
Merge branch 'develop' into stable
Diffstat (limited to 'src/SMAPI/Framework/Exceptions')
-rw-r--r-- | src/SMAPI/Framework/Exceptions/ContentLoadErrorType.cs | 21 | ||||
-rw-r--r-- | src/SMAPI/Framework/Exceptions/SContentLoadException.cs | 15 |
2 files changed, 34 insertions, 2 deletions
diff --git a/src/SMAPI/Framework/Exceptions/ContentLoadErrorType.cs b/src/SMAPI/Framework/Exceptions/ContentLoadErrorType.cs new file mode 100644 index 00000000..16689b67 --- /dev/null +++ b/src/SMAPI/Framework/Exceptions/ContentLoadErrorType.cs @@ -0,0 +1,21 @@ +namespace StardewModdingAPI.Framework.Exceptions +{ + /// <summary>Indicates why loading an asset through the content pipeline failed.</summary> + internal enum ContentLoadErrorType + { + /// <summary>The asset name is empty or has an invalid format.</summary> + InvalidName, + + /// <summary>The asset doesn't exist.</summary> + AssetDoesNotExist, + + /// <summary>The asset is not available in the current context (e.g. an attempt to load another mod's assets).</summary> + AccessDenied, + + /// <summary>The asset exists, but the data could not be deserialized or it doesn't match the expected type.</summary> + InvalidData, + + /// <summary>An unknown error occurred.</summary> + Other + } +} diff --git a/src/SMAPI/Framework/Exceptions/SContentLoadException.cs b/src/SMAPI/Framework/Exceptions/SContentLoadException.cs index be1fe748..4db24d06 100644 --- a/src/SMAPI/Framework/Exceptions/SContentLoadException.cs +++ b/src/SMAPI/Framework/Exceptions/SContentLoadException.cs @@ -7,12 +7,23 @@ namespace StardewModdingAPI.Framework.Exceptions internal class SContentLoadException : ContentLoadException { /********* + ** Accessors + *********/ + /// <summary>Why loading the asset through the content pipeline failed.</summary> + public ContentLoadErrorType ErrorType { get; } + + + /********* ** Public methods *********/ /// <summary>Construct an instance.</summary> + /// <param name="errorType">Why loading the asset through the content pipeline failed.</param> /// <param name="message">The error message.</param> /// <param name="ex">The underlying exception, if any.</param> - public SContentLoadException(string message, Exception? ex = null) - : base(message, ex) { } + public SContentLoadException(ContentLoadErrorType errorType, string message, Exception? ex = null) + : base(message, ex) + { + this.ErrorType = errorType; + } } } |