Skip to content

Commit f7d9c0a

Browse files
committed
Use separate error message copy for saving and clearing
1 parent 1e91f9c commit f7d9c0a

1 file changed

Lines changed: 17 additions & 7 deletions

File tree

‎routes/content-guidelines/components/guideline-accordion-form.tsx‎

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,15 @@ export default function GuidelineAccordionForm( {
8686
type: 'snackbar',
8787
} );
8888
} )
89-
.catch( ( e: Error ) => setError( e.message ) )
89+
.catch( ( e: Error ) =>
90+
setError(
91+
sprintf(
92+
/* translators: %s: Error message. */
93+
__( 'Error saving guidelines: %s' ),
94+
e.message
95+
)
96+
)
97+
)
9098
.finally( () => setLoading( false ) );
9199
};
92100

@@ -107,7 +115,13 @@ export default function GuidelineAccordionForm( {
107115
} );
108116
} )
109117
.catch( ( e: Error ) => {
110-
setError( e.message );
118+
setError(
119+
sprintf(
120+
/* translators: %s: Error message. */
121+
__( 'Error clearing guidelines: %s' ),
122+
e.message
123+
)
124+
);
111125
setGuideline( slug, oldValue );
112126
} )
113127
.finally( () => {
@@ -135,11 +149,7 @@ export default function GuidelineAccordionForm( {
135149
/>
136150
{ error && (
137151
<Notice status="error" onRemove={ () => setError( null ) }>
138-
{ sprintf(
139-
/* translators: %s: Error message. */
140-
__( 'Error saving guidelines: %s' ),
141-
error
142-
) }
152+
{ error }
143153
</Notice>
144154
) }
145155
<HStack spacing={ 4 } alignment="left">

0 commit comments

Comments
 (0)