11import textwrap
2- import traceback
3- from contextlib import contextmanager
42from dataclasses import dataclass
53from dataclasses import field
64from typing import Any
75from typing import Dict
8- from typing import Iterator
96from typing import Optional
107from typing import Type
118
12- import sentry_sdk
139from tabulate import tabulate
1410from tortoise .models import Model
1511
1612from dipdup import spec_version_mapping
1713from dipdup .enums import ReindexingReason
1814
19- _tab = ' \n \n ' + ('_' * 80 ) + '\n \n '
15+ _tab = ('_' * 80 ) + '\n \n '
2016
2117
2218def unindent (text : str ) -> str :
@@ -48,6 +44,7 @@ def __repr__(self) -> str:
4844 return f'{ self .__class__ .__name__ } : { self .__doc__ } '
4945
5046 def _help (self ) -> str :
47+ # TODO: Update guide
5148 return """
5249 Unexpected error occurred!
5350
@@ -61,18 +58,7 @@ def help(self) -> str:
6158 return unindent (self ._help ())
6259
6360 def format (self ) -> str :
64- exc = f'\n \n { traceback .format_exc ()} ' .rstrip ()
65- return _tab .join ([exc , self .help () + '\n ' ])
66-
67- @contextmanager
68- def wrap (ctx : Optional [Any ] = None ) -> Iterator [None ]:
69- try :
70- yield
71- except DipDupError :
72- raise
73- except Exception as e :
74- sentry_sdk .capture_exception (e )
75- raise DipDupError from e
61+ return _tab + self .help () + '\n '
7662
7763
7864@dataclass (frozen = True , repr = False )
@@ -138,7 +124,7 @@ def _help(self) -> str:
138124 ],
139125 headers = ['' , 'spec_version' , 'DipDup version' ],
140126 )
141- reindex = _tab + ReindexingRequiredError (ReindexingReason .MIGRATION ).help () if self .reindex else ''
127+ reindex = ' \n \n ' + _tab + ReindexingRequiredError (ReindexingReason .MIGRATION ).help () if self .reindex else ''
142128 return f"""
143129 Project migration required!
144130
0 commit comments