spack.error : fixed pickling and representation to permit to pass FetchErrors
This commit is contained in:
parent
bdf4832269
commit
284ed13fa6
@ -26,6 +26,7 @@
|
|||||||
import sys
|
import sys
|
||||||
import llnl.util.tty as tty
|
import llnl.util.tty as tty
|
||||||
import spack
|
import spack
|
||||||
|
import inspect
|
||||||
|
|
||||||
|
|
||||||
class SpackError(Exception):
|
class SpackError(Exception):
|
||||||
@ -49,7 +50,7 @@ def die(self):
|
|||||||
else:
|
else:
|
||||||
tty.error(self.message)
|
tty.error(self.message)
|
||||||
if self.long_message:
|
if self.long_message:
|
||||||
print self.long_message
|
print(self.long_message)
|
||||||
os._exit(1)
|
os._exit(1)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
@ -58,6 +59,16 @@ def __str__(self):
|
|||||||
msg += "\n %s" % self._long_message
|
msg += "\n %s" % self._long_message
|
||||||
return msg
|
return msg
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
args = [repr(self.message), repr(self.long_message)]
|
||||||
|
args = ','.join(args)
|
||||||
|
qualified_name = inspect.getmodule(
|
||||||
|
self).__name__ + '.' + type(self).__name__
|
||||||
|
return qualified_name + '(' + args + ')'
|
||||||
|
|
||||||
|
def __reduce__(self):
|
||||||
|
return type(self), (self.message, self.long_message)
|
||||||
|
|
||||||
|
|
||||||
class UnsupportedPlatformError(SpackError):
|
class UnsupportedPlatformError(SpackError):
|
||||||
"""Raised by packages when a platform is not supported"""
|
"""Raised by packages when a platform is not supported"""
|
||||||
|
Loading…
Reference in New Issue
Block a user