moved all error to Error.py

This commit is contained in:
Faraphel 2022-01-21 22:41:45 +01:00
parent b5ebe369b5
commit 85e36c461c
4 changed files with 36 additions and 36 deletions

33
source/Error.py Normal file
View file

@ -0,0 +1,33 @@
class RomAlreadyPatched(Exception):
def __init__(self):
super().__init__("ROM Already patched !")
class InvalidGamePath(Exception):
def __init__(self):
super().__init__("This path is not valid !")
class InvalidFormat(Exception):
def __init__(self):
super().__init__("This game format is not supported !")
class TooMuchSha1CheckFailed(Exception):
def __init__(self):
super().__init__("Too much sha1 check failed !")
class CantDownloadTrack(Exception):
def __init__(self, track, http_error: [str, int]):
super().__init__(f"Can't download track {track.name} ({track.sha1}) (error {http_error}) !")
class CantConvertTrack(Exception):
def __init__(self):
super().__init__("Can't convert track.")
class MissingTrackWU8(Exception):
def __init__(self):
super().__init__("The original wu8 track file is missing !")

View file

@ -7,26 +7,7 @@ import json
from source.CT_Config import CT_Config from source.CT_Config import CT_Config
from source.definition import * from source.definition import *
from source.wszst import * from source.wszst import *
from source.Error import *
class RomAlreadyPatched(Exception):
def __init__(self):
super().__init__("ROM Already patched !")
class InvalidGamePath(Exception):
def __init__(self):
super().__init__("This path is not valid !")
class InvalidFormat(Exception):
def __init__(self):
super().__init__("This game format is not supported !")
class TooMuchSha1CheckFailed(Exception):
def __init__(self):
super().__init__("Too much sha1 check failed !")
class NoGui: class NoGui:

View file

@ -1,7 +1,7 @@
import json import json
import os import os
from .definition import restart from source.definition import restart
class Option: class Option:

View file

@ -1,20 +1,6 @@
from source.definition import * from source.definition import *
from source.wszst import * from source.wszst import *
from source.Error import *
class CantDownloadTrack(Exception):
def __init__(self, track, http_error: [str, int]):
super().__init__(f"Can't download track {track.name} ({track.sha1}) (error {http_error}) !")
class CantConvertTrack(Exception):
def __init__(self):
super().__init__("Can't convert track.")
class MissingTrackWU8(Exception):
def __init__(self):
super().__init__("The original wu8 track file is missing !")
def get_trackdata_from_json(track_json, *args, **kwargs): def get_trackdata_from_json(track_json, *args, **kwargs):