Implemented ThrowError to throw PHP exceptions