Skip to content

Commit

Permalink
feat(error): make some properties on SimpleError public (#128)
Browse files Browse the repository at this point in the history
  • Loading branch information
bdunderscore authored Jan 27, 2024
1 parent 5a0e9e9 commit 31f89a0
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 16 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 5 additions & 5 deletions Editor/ErrorReporting/InlineError.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ private void AddContext(IEnumerable args, List<string> 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;
}
}
16 changes: 8 additions & 8 deletions Editor/ErrorReporting/SimpleError.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,46 +19,46 @@ public abstract class SimpleError : IError
/// <summary>
/// The Localizer to use to look up strings.
/// </summary>
protected abstract Localizer Localizer { get; }
public abstract Localizer Localizer { get; }

/// <summary>
/// The key to use for the title of the error. By default, all other keys are derived from this TitleKey.
/// </summary>
protected abstract string TitleKey { get; }
public abstract string TitleKey { get; }

/// <summary>
/// String substitutions to insert into the title of the error display. You can reference these with
/// e.g. `{0}`.
/// </summary>
protected virtual string[] TitleSubst => Array.Empty<string>();
public virtual string[] TitleSubst => Array.Empty<string>();

/// <summary>
/// The key to use for the details section of the error display. By default, this is the TitleKey + `:description`.
/// </summary>
protected virtual string DetailsKey => TitleKey + ":description";
public virtual string DetailsKey => TitleKey + ":description";

/// <summary>
/// String substitutions to insert into the details section of the error display. You can reference these with
/// e.g. `{0}`.
/// </summary>
protected virtual string[] DetailsSubst => Array.Empty<string>();
public virtual string[] DetailsSubst => Array.Empty<string>();

/// <summary>
/// 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.
/// </summary>
protected virtual string HintKey => TitleKey + ":hint";
public virtual string HintKey => TitleKey + ":hint";

/// <summary>
/// String substitutions to insert into the hint section of the error display. You can reference these with
/// e.g. `{0}`.
/// </summary>
protected virtual string[] HintSubst => Array.Empty<string>();
public virtual string[] HintSubst => Array.Empty<string>();

/// <summary>
/// Any ObjectReferences to display to the user; the user will be able to click to jump to these objects.
/// </summary>
protected List<ObjectReference> _references = new List<ObjectReference>();
public List<ObjectReference> _references = new List<ObjectReference>();

/// <summary>
/// Any ObjectReferences to display to the user; the user will be able to click to jump to these objects.
Expand Down
6 changes: 3 additions & 3 deletions Editor/ErrorReporting/StackTraceError.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
Expand Down

0 comments on commit 31f89a0

Please sign in to comment.