implemented an error exception class for manage the error in api class