API error reporting

Signed-off-by: DrWhatNoName <drwhat@cryto.net>