diff pytouhou/formats/pbg3.py @ 377:70e2ed71b09c

Add meaningful exceptions in format parsing.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Wed, 29 Aug 2012 18:34:28 +0200
parents b5c7369abd7c
children 1b532e7dd521
line wrap: on
line diff
--- a/pytouhou/formats/pbg3.py
+++ b/pytouhou/formats/pbg3.py
@@ -28,6 +28,8 @@ import pytouhou.utils.lzss as lzss
 
 from pytouhou.utils.helpers import get_logger
 
+from pytouhou.formats import WrongFormatError
+
 logger = get_logger(__name__)
 
 
@@ -101,7 +103,7 @@ class PBG3(object):
 
         magic = file.read(4)
         if magic != b'PBG3':
-            raise Exception #TODO
+            raise WrongFormatError(magic)
 
         bitstream = PBG3BitStream(file)
         entries = {}