improve flexibility of error handling for json dispatcher