# Copyright (C) 2017-2019 Lars Wirzenius # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . class IckException(Exception): pass class NotFound(Exception): def __init__(self, kind, name): super().__init__( 'Resource {}:{} not found'.format( kind or "unknown", name or "unknown")) class ExistsAlready(IckException): def __init__(self, name): super().__init__('Resource {} already exists'.format(name)) class Conflict(IckException): def __init__(self, rid, expected, got): super().__init__( 'Update conflict for {}: expected revision {}, got {}'.format( rid, expected, got)) class BadUpdate(IckException): def __init__(self, how): super().__init__('Work update is BAD: {}'.format(how)) class ClientIdMissing(IckException): def __init__(self): super().__init__('Access token is missing "aud"') class MethodNotAllowed(IckException): pass class ParametersMissing(IckException): def __init__(self, names): super().__init__( 'Project must define parameters: {}'.format(' '. join(names)))