malgleam/error
API 에러코드 및 라이브러리 에러 타입. 기상청 Open API 3종이 공유하는 에러코드 체계를 Gleam variant로 제공한다.
Types
라이브러리 전체에서 사용하는 통합 에러 타입.
pub type ApiError {
ApiServiceError(code: ErrorCode, message: String)
JsonDecodeError(message: String)
UnexpectedResponse(body: String)
}
Constructors
-
ApiServiceError(code: ErrorCode, message: String)API가 resultCode != “00” 을 반환한 경우
-
JsonDecodeError(message: String)JSON 파싱 또는 디코딩 실패
-
UnexpectedResponse(body: String)예상치 못한 응답 구조
기상청 Open API 에러코드 (01~99).
pub type ErrorCode {
ApplicationError
DbError
NoDataError
HttpError
ServiceTimeOut
InvalidRequestParameter
NoMandatoryParameter
NoOpenApiService
ServiceAccessDenied
DisabledServiceKey
RequestLimitExceeded
UnregisteredServiceKey
ExpiredServiceKey
UnregisteredIp
UnsignedCall
UnknownError
}
Constructors
-
ApplicationError01 — 어플리케이션 에러
-
DbError02 — 데이터베이스 에러
-
NoDataError03 — 데이터없음 에러
-
HttpError04 — HTTP 에러
-
ServiceTimeOut05 — 서비스 연결실패 에러
-
InvalidRequestParameter10 — 잘못된 요청 파라메터 에러
-
NoMandatoryParameter11 — 필수요청 파라메터가 없음
-
NoOpenApiService12 — 해당 오픈API서비스가 없거나 폐기됨
-
ServiceAccessDenied20 — 서비스 접근거부
-
DisabledServiceKey21 — 일시적으로 사용할 수 없는 서비스 키
-
RequestLimitExceeded22 — 서비스 요청제한횟수 초과에러
-
UnregisteredServiceKey30 — 등록되지 않은 서비스키
-
ExpiredServiceKey31 — 기한만료된 서비스키
-
UnregisteredIp32 — 등록되지 않은 IP
-
UnsignedCall33 — 서명되지 않은 호출
-
UnknownError99 — 기타에러
Values
pub fn parse_error_code(code: String) -> ErrorCode
에러코드 문자열(“01”~“99”)을 ErrorCode variant로 변환한다.