move exception to api package