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

Implement __format__ for a more fine grained output of the error #28

Open
3 tasks
Nicoretti opened this issue Sep 26, 2023 · 0 comments · May be fixed by #50
Open
3 tasks

Implement __format__ for a more fine grained output of the error #28

Nicoretti opened this issue Sep 26, 2023 · 0 comments · May be fixed by #50
Assignees
Labels
feature Product feature

Comments

@Nicoretti
Copy link
Member

Summary

Enable the user to fine grain controls regarding the formatting, by implementing the __format__ magic method (see also).

Examples

error = error.ExaError(
    name="E-TEST-2",
    message="Fire in the server room",
    mitigations=[
        "Use the fire extinguisher",
        "flood the room with halon gas (Attention: be sure no humans in the room!)"
    ],
    parameters={}
)

print(error)
> E-TEST-2: Fire in the server room Known mitigations:
> * Use the fire extinguisher
> * flood the room with halon gas (Attention: be sure no humans in the room!)

print(f'{error:name})
> E-TEST-2

print(f'{error:short})
> E-TEST-2 - Fire in the server room.

TODO's

  • Implement __format__
    • name
    • short
    • ...
  • Add tests for formatting options
  • Document the formatting options
@Nicoretti Nicoretti added the feature Product feature label Sep 26, 2023
Nicoretti added a commit that referenced this issue Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Product feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants