File tree Expand file tree Collapse file tree
plugins/bulk-import/src/components/AddRepositories Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ ' @red-hat-developer-hub/backstage-plugin-bulk-import ' : patch
3+ ---
4+
5+ fix generic error when pr creation fails
Original file line number Diff line number Diff line change @@ -19,7 +19,6 @@ import Alert from '@mui/material/Alert';
1919import AlertTitle from '@mui/material/AlertTitle' ;
2020import FormControl from '@mui/material/FormControl' ;
2121import { useFormikContext } from 'formik' ;
22- import { get } from 'lodash' ;
2322
2423import { AddRepositoriesFormValues , PullRequestPreviewData } from '../../types' ;
2524import { PreviewFileSidebar } from '../PreviewFile/PreviewFileSidebar' ;
@@ -45,6 +44,9 @@ export const AddRepositories = ({ error }: { error: any }) => {
4544 } ) ;
4645 setOpenDrawer ( false ) ;
4746 } ;
47+
48+ const errorMessage = error ?. error ?. message && JSON . parse ( error . error . message ) ;
49+
4850 return (
4951 < >
5052 < FormControl fullWidth >
@@ -57,8 +59,14 @@ export const AddRepositories = ({ error }: { error: any }) => {
5759 { error && (
5860 < div style = { { paddingBottom : '10px' } } >
5961 < Alert severity = "error" >
60- < AlertTitle > { get ( error , 'name' ) || 'Error occured' } </ AlertTitle >
61- { get ( error , 'err' ) || 'Failed to create pull request' }
62+ < AlertTitle >
63+ { errorMessage ?. error ?. name ??
64+ error ?. error ?. name ??
65+ 'Error occured' }
66+ </ AlertTitle >
67+ { errorMessage ?. error ?. message ??
68+ error ?. err ??
69+ 'Failed to create pull request' }
6270 </ Alert >
6371 </ div >
6472 ) }
You can’t perform that action at this time.
0 commit comments