Planned for Future Release

Indeed, it may be desirable to render whatever is available instead of showing an "Internal Server Error" to the end-user.

However, if include Pages are missing, essential parts of web pages may be missing (resulting in a bad User Experience).

I assume you do want to log this problem in order for System Administrators to be alerted ASAP. Where should the logging be done?  Model Service log file?  Web Application log file?  Both?

Should the rendered Page still contain the missing Regions containing an error message, similar to Entities for which model mapping failed?

Note that we're prioritizing incorporation of Community-reported Issues with associated Pull Request in DXA 2.2.  So, if you want to have this included in DXA 2.2, please submit the Issue and Pull Request on GitHub. 

Unpublished Include Pages should not cause error

When requesting a page that has include pages, if any of those include pages are not found, the model service returns the a message like following:

{
"timestamp": [
"String",
"2019-02-01T11:35:55.973+0000"
],
"status": 500,
"error": "Internal Server Error",
"exception": "com.sdl.webapp.common.api.content.ContentProviderException",
"message": "Content Service returned null for request pubId = 1pageId = 2",
"path": "/PageModel/tcm/1/index"
}

The request for the above would have been "http://localhost:8998/PageModel/tcm/1/index?includes=INCLUDE&modelType=R2"

It would make more sense for the service to return the page without the include page.

  • This has been solved as of 2019-01-25 with the 2.1.1 version of the Model service.

  • Thanks for responding to this Idea.

    I believe there is room for optional Include Pages. An example could be alert messages, popus or modals, that are supposed to be diplayed on every page, but it's up to the editor if it should or should not be displayed. That could be controlled by publishing/unpublishing the Include Page.

    This seems to have been the philosophy for DXA 1.7, where the following source code can be found for DefaultContentProvider:

    protected virtual IEnumerable<IPage> GetIncludesFromModel(IPage page, Localization localization)

    {

    using (new Tracer(page.Id, localization))

    {

    List<IPage> result = new List<IPage>();

    string[] pageTemplateTcmUriParts = page.PageTemplate.Id.Split('-');

    IEnumerable<string> includePageUrls = localization.GetIncludePageUrls(pageTemplateTcmUriParts[1]);

    foreach (string includePageUrl in includePageUrls)

    {

    IPage includePage = GetPage(SiteConfiguration.LocalizeUrl(includePageUrl, localization), localization);

    if (includePage == null)

    {

    Log.Error("Include Page '{0}' not found.", includePageUrl);

    continue;

    }

    result.Add(includePage);

    }

    return result;

    }

    }

    It can be seen that the foreach loop properly continues whenever an Include Page is missing. This behaviour has changed in DXA 2.0, is it documented anywhere?

    The logging should be done in the same way as all exceptions in the model service. For 1.7 it was logged in the application logs.

    No error message should be displayed, just as it did not for 1.7.

  • Thanks for submitting this Idea. It makes sense, but we have some additional questions; see Status Notes above.