Skip to content

Commit c149009

Browse files
committed
change to another exception clas
1 parent 4fe3946 commit c149009

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

pipenv/core.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -544,8 +544,8 @@ def ensure_project(
544544
raise exceptions.PipfileNotFound
545545
# Fail if working under /
546546
if not project.name:
547-
raise exceptions.PipenvUsageError(
548-
"Pipenv is not intended to work under root directory, "
547+
raise exceptions.PipfileException(
548+
"Pipenv is not intended to work under the root directory, "
549549
"please choose another path."
550550
)
551551
# Skip virtualenv creation when --system was used.

pipenv/exceptions.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ def handle_exception(exc_type, exception, traceback, hook=sys.excepthook):
4444

4545

4646
class PipenvException(ClickException):
47-
message = "{0}: {{0}}".format(crayons.red("ERROR", bold=True))
47+
formatted_message = "{0} {{0}}".format(crayons.red("ERROR:", bold=True))
4848

4949
def __init__(self, message=None, **kwargs):
5050
if not message:
5151
message = "Pipenv encountered a problem and had to exit."
5252
extra = kwargs.pop("extra", [])
53-
message = self.message.format(message)
53+
message = self.formatted_message.format(message)
5454
ClickException.__init__(self, message)
5555
self.extra = extra
5656

@@ -69,15 +69,13 @@ def show(self, file=None):
6969

7070

7171
class PipenvUsageError(UsageError):
72+
formatted_message = "{0} {{0}}".format(crayons.red("ERROR:", bold=True))
7273

7374
def __init__(self, message=None, ctx=None, **kwargs):
74-
formatted_message = "{0}: {1}"
75-
msg_prefix = crayons.red("ERROR:", bold=True)
7675
if not message:
7776
message = "Pipenv encountered a problem and had to exit."
78-
message = formatted_message.format(msg_prefix, crayons.white(message, bold=True))
79-
self.message = message
8077
extra = kwargs.pop("extra", [])
78+
message = self.formatted_message.format(message)
8179
UsageError.__init__(self, fix_utf8(message), ctx)
8280
self.extra = extra
8381

0 commit comments

Comments
 (0)