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

feat(error): make some properties on SimpleError public #128

Merged
merged 1 commit into from
Jan 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading