giambio/giambio/exceptions.py

47 lines
1.2 KiB
Python
Raw Normal View History

2020-07-05 08:58:23 +02:00
"""
Copyright (C) 2020 nocturn9x
2020-07-05 08:58:23 +02:00
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
2020-07-05 08:58:23 +02:00
http://www.apache.org/licenses/LICENSE-2.0
2020-07-05 08:58:23 +02:00
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
2020-07-05 08:58:23 +02:00
"""
2020-03-19 18:24:06 +01:00
class GiambioError(Exception):
"""Base class for gaimbio exceptions"""
pass
2020-03-19 19:48:24 +01:00
class AlreadyJoinedError(GiambioError):
pass
2020-03-20 11:27:26 +01:00
2020-03-25 18:37:57 +01:00
class CancelledError(BaseException):
2020-03-20 11:27:26 +01:00
"""Exception raised as a result of the giambio.core.cancel() method"""
2020-03-23 18:52:17 +01:00
def __repr__(self):
return "giambio.exceptions.CancelledError"
2020-07-05 08:58:23 +02:00
class ResourceBusy(GiambioError):
"""Exception that is raised when a resource is accessed by more than
one task at a time"""
pass
class BrokenPipeError(GiambioError):
"""Wrapper around the broken pipe socket.error"""
pass
class ResourceClosed(GiambioError):
"""Raised when I/O is attempted on a closed fd"""
pass