Skip to content

Commit

Permalink
add custom exception
Browse files Browse the repository at this point in the history
  • Loading branch information
kimsehwan96 committed Mar 3, 2021
1 parent 206574b commit e464419
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions pyjosa/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
class NotHangleException(Exception):
def __init__(self):
super().__init__("마지막 글자가 한글이 아닙니다.")

class JosaTypeException(Exception):
def __init__(self):
super().__init__("메서드의 인자로 주어진 조사가 올바르지 않습니다.")
6 changes: 3 additions & 3 deletions pyjosa/josa.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from pyjosa.jonsung import has_jongsung

from pyjosa.exceptions import JosaTypeException

class Josa:

Expand All @@ -19,7 +19,7 @@ def get_josa(string, josa) -> str:
elif (josa == '으로') or (josa == '로'):
return '으로' if has_jongsung(string) else '로'
else:
raise Exception("올바르지 않은 조사.")
raise JosaTypeException

@staticmethod
def get_full_string(string, josa) -> str:
Expand All @@ -37,4 +37,4 @@ def get_full_string(string, josa) -> str:
elif (josa == '으로') or (josa == '로'):
return string + '으로' if has_jongsung(string) else string + '로'
else:
raise Exception("올바르지 않은 조사.")
raise JosaTypeException
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name = 'pyjosa',
version = '0.0.9',
version = '0.0.10',
description = '한국어 조사 처리 패키지',
author = 'sehwan.kim',
author_email = '[email protected]',
Expand Down

0 comments on commit e464419

Please sign in to comment.