You are not logged in.
Pages: 1
procedure TBlogApplication.AuthorView(var ID: TID; var Author: TOrmAuthor; out Articles: variant);
begin
RestModel.Orm.Retrieve(ID, Author);
Author.HashedPassword := '';
if Author.ID <> 0 then
Articles := RestModel.Orm.RetrieveDocVariantArray(TOrmArticle, '',
'Author=? order by RowId desc limit 50', [ID], ARTICLE_FIELDS)
else
EMvcApplication.GotoError(HTTP_NOTFOUND);
end;
When opening this link http://localhost:8092/blog/AuthorView, the backend directly exits and an exception message pops up.
Offline
Where? In the IDE?
This is a regular exception. So by default, it will popup in the IDE. You need to disable the EMvcApplication exception class in your IDE options.
But a cleaner (and faster) way, now available with latest TMvcApplication, is to call RedirectError() instead.
Update your framework source code and your sample source.
Offline
mormot '2.3.11868'
When running in the Lazarus IDE, and when running directly, it crashes. I don’t want the site to stop; if I execute this directly, the backend crashes, because your example was written that way, so I tested it.
I now have a requirement: if the user is not logged in, do not render the HTML code—return a notice page or return an informational message directly. Otherwise, I want to wrap the entire frontend source with {{#CookieData.Status}} ALL HTML {{/CookieData.Status}}.
I’m not sure whether my idea and direction are correct, or if there are other methods! I’m using an interface-based approach, and it seems I can’t use the gotoerror method, so I’m lost.
Offline
Pages: 1