Skip to content

Commit

Permalink
Make amp-form failure message developer-friendlier (ampproject#35964)
Browse files Browse the repository at this point in the history
This can happen whenever the XHR proxy server returns an error and
doesn't include the HTML to render the submit-failure template (e.g.,
AMP CORS failure, unreacheable proxy). Sever-side rendering of template
is an implementation detail of AMP for Email that developers shouldn't
care about so it makes sense to change this to one that would make more
sense for developers.
  • Loading branch information
zhangsu authored and Mahir committed Sep 9, 2021
1 parent 9d8c7b5 commit 55bd45f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/ssr-template-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export class SsrTemplateHelper {
if (this.isEnabled()) {
userAssert(
typeof data['html'] === 'string',
'Server side html response must be defined'
'Skipping template rendering due to failed fetch'
);
renderTemplatePromise = this.assertTrustedViewer(element).then(() => {
return this.templates_.findAndSetHtmlForTemplate(
Expand Down
2 changes: 1 addition & 1 deletion test/unit/test-ssr-template-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ describes.fakeWin(
allowConsoleError(() => {
expect(() => {
ssrTemplateHelper.applySsrOrCsrTemplate({}, {html: null});
}).to.throw(/Server side html response must be defined/);
}).to.throw(/Skipping template rendering due to failed fetch/);
});
});

Expand Down

0 comments on commit 55bd45f

Please sign in to comment.