class MediaWikiApiErrorHandler {

	public static void throwMediaWikiApiErrorException(String errorCode,
			String errorMessage) throws MediaWikiApiErrorException {
		switch (errorCode) {
		case ERROR_NO_TOKEN:
		case ERROR_INVALID_TOKEN:
			throw new TokenErrorException(errorCode, errorMessage);
		case ERROR_EDIT_CONFLICT:
			throw new EditConflictErrorException(errorMessage);
		case ERROR_NO_SUCH_ENTITY:
			throw new NoSuchEntityErrorException(errorMessage);
		case ERROR_MAXLAG:
			throw new MaxlagErrorException(errorMessage);
		case ERROR_ASSERT_USER_FAILED:
			throw new AssertUserFailedException(errorMessage);
		case ERROR_TAGS_APPLY_NOT_ALLOWED:
			throw new TagsApplyNotAllowedException(errorMessage);
		default:
			throw new MediaWikiApiErrorException(errorCode, errorMessage);
		}
	}

}