Skip to content

Commit

Permalink
feat: add beet.contrib.error_message
Browse files Browse the repository at this point in the history
  • Loading branch information
vberlier committed Aug 6, 2023
1 parent 4c79d4e commit cf3faf6
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
24 changes: 24 additions & 0 deletions beet/contrib/error_message.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
"""Plugin for raising an error message."""


__all__ = [
"error_message",
"ErrorMessageOptions",
]


from beet import Context, ErrorMessage, PluginOptions, configurable


class ErrorMessageOptions(PluginOptions):
message: str


def beet_default(ctx: Context):
ctx.require(error_message)


@configurable(validator=ErrorMessageOptions)
def error_message(ctx: Context, opts: ErrorMessageOptions):
"""Plugin for raising an error message."""
raise ErrorMessage(opts.message)
5 changes: 5 additions & 0 deletions beet/contrib/log_level.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
"""Plugin for setting the log level."""


__all__ = [
"log_level",
"LogLevelOptions",
]

import logging
from typing import Literal

Expand Down

0 comments on commit cf3faf6

Please sign in to comment.