Added statusCode from inner error if there isn't any
Added unit tests for inner errors