Skip to content

[FEATURE] Add new create method for a Problem representing a generic error #33

Description

@nandos13

Is your feature request related to a problem? Please describe.

This is a suggestion to reduce code duplication in the project. It may also be useful for users.

Describe the solution you'd like

Add a publicly accessible Problem.Create -like method for the 'generic error' problem (Titles.Error, Messages.GenericError in ProblemConstants) to reduce code repetition.

Proposed API

// Proposed added method
public static Problem GenericError()
{
    return Create(ProblemConstants.Titles.Error, ProblemConstants.Messages.GenericError);
}

// Example of usage for user code
Problem? p = ...;
DoSomethingWithProblem(p ?? Problem.GenericError());

Use Case

These title & detail strings are used together frequently. A helper method would be nice. In user code, it may also be useful as a fallback, as shown above.

Are you willing to contribute?

  • Yes, I'd like to implement this feature
  • Yes, but I need guidance
  • No, but I'm available for testing
  • No

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions