| @@ -96,7 +96,14 @@ | ||
| 96 | 96 | if ( ! is_wp_error( $wp_error ) ) { |
| 97 | 97 | return self::error( 'An unknown error occurred.' ); |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - return self::error( $wp_error->get_error_message() ); | |
| 100 | + // Carry the machine-readable code alongside the prose. The brain | |
| 101 | + // classifies and steers a refused write on `data.code`; without it the | |
| 102 | + // only signal on the wire is an English sentence that unrelated PRs | |
| 103 | + // reword. | |
| 104 | + $code = (string) $wp_error->get_error_code(); | |
| 105 | + $data = '' !== $code ? array( 'code' => $code ) : array(); | |
| 106 | + | |
| 107 | + return self::error( $wp_error->get_error_message(), '', $data ); | |
| 101 | 108 | } |
| 102 | 109 | } |