raise appropriate exception