Skip to content

Commit dc06b64

Browse files
reuse react on rails handleError inside rorp handleError function
1 parent fa99d61 commit dc06b64

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

packages/react-on-rails-pro/src/handleError.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
1-
import * as React from 'react';
21
import { Readable } from 'stream';
32
import { ErrorOptions } from 'react-on-rails/types';
4-
import { renderToString } from 'react-on-rails/ReactDOMServer';
5-
import generateRenderingErrorMessage from 'react-on-rails/generateRenderingErrorMessage';
3+
import handleErrorAsString from 'react-on-rails/handleError';
64

75
const handleError = (options: ErrorOptions) => {
8-
const msg = generateRenderingErrorMessage(options);
9-
const reactElement = React.createElement('pre', null, msg);
10-
const htmlString = renderToString(reactElement);
6+
const htmlString = handleErrorAsString(options);
117
return Readable.from([htmlString]);
128
};
139

0 commit comments

Comments
 (0)