mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-06-27 21:16:14 +02:00
Reformat messages and add new centralized exception handling (#1417)
* Update and modularize exception handling cc #1024 #1141 - Stack traces are no longer shown to users unless the --debug flag is being used - Errors, warnings, and other messages contain color as needed - Converted error messages to Enum - Adds print_msg function to centralize output (this should replace all other output in other modules) Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
This commit is contained in:
parent
d6ff04cf17
commit
5273f8769d
11 changed files with 204 additions and 96 deletions
|
@ -1,19 +0,0 @@
|
|||
import textwrap
|
||||
|
||||
from jrnl.exception import JrnlError
|
||||
|
||||
|
||||
def test_config_directory_exception_message():
|
||||
ex = JrnlError(
|
||||
"ConfigDirectoryIsFile", config_directory_path="/config/directory/path"
|
||||
)
|
||||
|
||||
assert ex.message == textwrap.dedent(
|
||||
"""
|
||||
The path to your jrnl configuration directory is a file, not a directory:
|
||||
|
||||
/config/directory/path
|
||||
|
||||
Removing this file will allow jrnl to save its configuration.
|
||||
"""
|
||||
)
|
|
@ -1,6 +1,7 @@
|
|||
import pytest
|
||||
|
||||
from jrnl.exception import JrnlError
|
||||
from jrnl.exception import JrnlException
|
||||
|
||||
from jrnl.plugins.fancy_exporter import check_provided_linewrap_viability
|
||||
|
||||
|
||||
|
@ -23,6 +24,5 @@ class TestFancy:
|
|||
|
||||
total_linewrap = 12
|
||||
|
||||
with pytest.raises(JrnlError) as e:
|
||||
with pytest.raises(JrnlException):
|
||||
check_provided_linewrap_viability(total_linewrap, [content], journal)
|
||||
assert e.value.error_type == "LineWrapTooSmallForDateFormat"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue