Improve errors

This commit is contained in:
Bartłomiej Pluta
2019-06-30 20:05:23 +02:00
parent 65353a80f2
commit d0b3a8b3da
8 changed files with 105 additions and 94 deletions

View File

@@ -1,6 +1,6 @@
from enum import Enum
from Error import ParseError
import math
from Error import SyntaxException
class NotePitch(Enum):
C = 0
@@ -52,7 +52,7 @@ class NotePitch(Enum):
}
return map[string.lower()]
except KeyError as e:
raise ParseError(f"Note '{string}' does not exist")
raise SyntaxException(None, f"Note '{string}' does not exist")
class Note:
def __init__(self, note, octave = 4, duration = 4):