52 lines
1009 B
Python
52 lines
1009 B
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
"""
|
|
自定義例外模組
|
|
|
|
Author: PANJIT IT Team
|
|
Created: 2024-01-28
|
|
Modified: 2024-01-28
|
|
"""
|
|
|
|
|
|
class DocumentTranslatorError(Exception):
|
|
"""文件翻譯系統基礎例外"""
|
|
def __init__(self, message, error_code=None):
|
|
self.message = message
|
|
self.error_code = error_code
|
|
super().__init__(self.message)
|
|
|
|
|
|
class AuthenticationError(DocumentTranslatorError):
|
|
"""認證相關例外"""
|
|
pass
|
|
|
|
|
|
class ValidationError(DocumentTranslatorError):
|
|
"""驗證相關例外"""
|
|
pass
|
|
|
|
|
|
class TranslationError(DocumentTranslatorError):
|
|
"""翻譯相關例外"""
|
|
pass
|
|
|
|
|
|
class FileProcessingError(DocumentTranslatorError):
|
|
"""檔案處理相關例外"""
|
|
pass
|
|
|
|
|
|
class APIError(DocumentTranslatorError):
|
|
"""API 相關例外"""
|
|
pass
|
|
|
|
|
|
class ConfigurationError(DocumentTranslatorError):
|
|
"""配置相關例外"""
|
|
pass
|
|
|
|
|
|
class DatabaseError(DocumentTranslatorError):
|
|
"""資料庫相關例外"""
|
|
pass |