From 31f89a08b84618a76fb1b9470643b1eb8d5516b7 Mon Sep 17 00:00:00 2001 From: bd_ Date: Sat, 27 Jan 2024 20:01:30 +0900 Subject: [PATCH] feat(error): make some properties on SimpleError public (#128) --- CHANGELOG.md | 1 + Editor/ErrorReporting/InlineError.cs | 10 +++++----- Editor/ErrorReporting/SimpleError.cs | 16 ++++++++-------- Editor/ErrorReporting/StackTraceError.cs | 6 +++--- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a88855e..b80cdf1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed ### Changed +- Made a number of properties on `SimpleError` public (#128) ### Removed diff --git a/Editor/ErrorReporting/InlineError.cs b/Editor/ErrorReporting/InlineError.cs index 0348516..aee02a7 100644 --- a/Editor/ErrorReporting/InlineError.cs +++ b/Editor/ErrorReporting/InlineError.cs @@ -61,12 +61,12 @@ private void AddContext(IEnumerable args, List substitutions) } } - protected override Localizer Localizer { get; } + public override Localizer Localizer { get; } public override ErrorSeverity Severity { get; } - protected override string TitleKey { get; } + public override string TitleKey { get; } - protected override string[] TitleSubst => _subst; - protected override string[] DetailsSubst => _subst; - protected override string[] HintSubst => _subst; + public override string[] TitleSubst => _subst; + public override string[] DetailsSubst => _subst; + public override string[] HintSubst => _subst; } } \ No newline at end of file diff --git a/Editor/ErrorReporting/SimpleError.cs b/Editor/ErrorReporting/SimpleError.cs index b96299a..41fd3b0 100644 --- a/Editor/ErrorReporting/SimpleError.cs +++ b/Editor/ErrorReporting/SimpleError.cs @@ -19,46 +19,46 @@ public abstract class SimpleError : IError /// /// The Localizer to use to look up strings. /// - protected abstract Localizer Localizer { get; } + public abstract Localizer Localizer { get; } /// /// The key to use for the title of the error. By default, all other keys are derived from this TitleKey. /// - protected abstract string TitleKey { get; } + public abstract string TitleKey { get; } /// /// String substitutions to insert into the title of the error display. You can reference these with /// e.g. `{0}`. /// - protected virtual string[] TitleSubst => Array.Empty(); + public virtual string[] TitleSubst => Array.Empty(); /// /// The key to use for the details section of the error display. By default, this is the TitleKey + `:description`. /// - protected virtual string DetailsKey => TitleKey + ":description"; + public virtual string DetailsKey => TitleKey + ":description"; /// /// String substitutions to insert into the details section of the error display. You can reference these with /// e.g. `{0}`. /// - protected virtual string[] DetailsSubst => Array.Empty(); + public virtual string[] DetailsSubst => Array.Empty(); /// /// The key to use for the hint section of the error display. By default, this is the TitleKey + `:hint`. /// This section should be used to provide a hint to the user about how to resolve the error. /// - protected virtual string HintKey => TitleKey + ":hint"; + public virtual string HintKey => TitleKey + ":hint"; /// /// String substitutions to insert into the hint section of the error display. You can reference these with /// e.g. `{0}`. /// - protected virtual string[] HintSubst => Array.Empty(); + public virtual string[] HintSubst => Array.Empty(); /// /// Any ObjectReferences to display to the user; the user will be able to click to jump to these objects. /// - protected List _references = new List(); + public List _references = new List(); /// /// Any ObjectReferences to display to the user; the user will be able to click to jump to these objects. diff --git a/Editor/ErrorReporting/StackTraceError.cs b/Editor/ErrorReporting/StackTraceError.cs index 9851d17..ff15ed4 100644 --- a/Editor/ErrorReporting/StackTraceError.cs +++ b/Editor/ErrorReporting/StackTraceError.cs @@ -25,11 +25,11 @@ public StackTraceError(Exception e, string additionalStackTrace = null) } } - protected override Localizer Localizer => NDMFLocales.L; - protected override string TitleKey => "Errors:InternalError"; + public override Localizer Localizer => NDMFLocales.L; + public override string TitleKey => "Errors:InternalError"; public override ErrorSeverity Severity => ErrorSeverity.InternalError; - protected override string[] DetailsSubst => new [] + public override string[] DetailsSubst => new [] { _e.GetType().Name };