Recent

Author Topic: [SOLVED] Kind of Error in TFPWebModule  (Read 5311 times)

egsuh

  • Hero Member
  • *****
  • Posts: 1266
[SOLVED] Kind of Error in TFPWebModule
« on: July 07, 2021, 09:10:38 am »
In general form's object inspector, the compiler asks whether to remove the event handler, if the corresponding procedure is not found in the unit file.

This is not applied to TFPWebModule.  When I assign an action's event handler, e.g. OnRequest, and then I delete the procedure from the unit file (so the procedure name remains in the object inspector.)  In this case, the application compiles without any error or warning. But the application just issues 500 error when it is called from web browser. I can detect this error if I access localhost, but not xxxxx.com, etc.

Hope the error is detected at the compilation stage.
« Last Edit: July 07, 2021, 01:45:24 pm by egsuh »

PascalDragon

  • Hero Member
  • *****
  • Posts: 5444
  • Compiler Developer
Re: Kind of Error in TFPWebModule
« Reply #1 on: July 07, 2021, 09:43:41 am »
In general form's object inspector, the compiler asks whether to remove the event handler, if the corresponding procedure is not found in the unit file.

The compiler asks nothing in that regard. It couldn't even care less. It's the IDE itself that handles this.

Hope the error is detected at the compilation stage.

Again, not the compiler that handles this. Best report a bug for the IDE (maybe the code that does that detection for forms simply doesn't work for data modules or something like that).

Thaddy

  • Hero Member
  • *****
  • Posts: 14157
  • Probably until I exterminate Putin.
Re: Kind of Error in TFPWebModule
« Reply #2 on: July 07, 2021, 09:46:23 am »
About the same as Sven with a little remark.:
Well, that's neigh impossible.
You should handle any web error in code.
(You should do that anyway)

But if you mean that removed code..is not removed.. through the object inspector.. is still compiled then it is probably a bug. Check the code.
« Last Edit: July 07, 2021, 10:01:14 am by Thaddy »
Specialize a type, not a var.

PascalDragon

  • Hero Member
  • *****
  • Posts: 5444
  • Compiler Developer
Re: Kind of Error in TFPWebModule
« Reply #3 on: July 07, 2021, 09:50:20 am »
But if you mean that removed code..is not removed.. through the object inspector.. is still compiled than it is probably a bug. Check the code.

Unassigning an event handler does not necessary mean that it should be removed right away, cause one might want to use for another event (e.g. I created the event handler by assigning OnShow, but now I noticed that I need it for OnActivate instead). That's why the IDE checks this only upon Save (and maybe upon initializing a compilation, though that might coincide with a Save).

Thaddy

  • Hero Member
  • *****
  • Posts: 14157
  • Probably until I exterminate Putin.
Re: Kind of Error in TFPWebModule
« Reply #4 on: July 07, 2021, 09:58:37 am »
You are right, I did not consider this scenario, but basically what I wrote still holds?
I mean web errors need to be handled in code and at runtime, not compile time..
Specialize a type, not a var.

egsuh

  • Hero Member
  • *****
  • Posts: 1266
Re: Kind of Error in TFPWebModule
« Reply #5 on: July 07, 2021, 10:05:35 am »
Okay, it's IDE issue, not compiler's.  Anyway I hope it is detected during compilation. 

The issue is not remaining code.  I erase the procedure (e.g. procedure HelloRequest, etc.) from both of interface and implementation sections of unit file. But the name is still stay in object inspector. This error is detected during compilation with TForm etc., but not with TFPWebModule.

PascalDragon

  • Hero Member
  • *****
  • Posts: 5444
  • Compiler Developer
Re: Kind of Error in TFPWebModule
« Reply #6 on: July 07, 2021, 01:26:12 pm »
The issue is not remaining code.  I erase the procedure (e.g. procedure HelloRequest, etc.) from both of interface and implementation sections of unit file. But the name is still stay in object inspector. This error is detected during compilation with TForm etc., but not with TFPWebModule.

As said, report a bug for the IDE.

egsuh

  • Hero Member
  • *****
  • Posts: 1266
Re: [SOLVED] Kind of Error in TFPWebModule
« Reply #7 on: July 08, 2021, 04:34:24 am »
I have reported this to bug tracker. I'm adding here, because I cannot modify my previous content. 

I came to think that one possibility is that the problematic property is because it is not the property of module itself, but is property's object's property.
Currently problematic property is event handler of one of Actions of TFPWebModule. The object inspector is opened when I click Actions of TFPWebModule and then select one action of them.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4458
  • I like bugs.
Re: Kind of Error in TFPWebModule
« Reply #8 on: July 10, 2021, 09:01:19 am »
@egsuh, ping.
Your report has feedback status since wednesday, asking to test with Lazarus trunk or the new fixes_2_2 branch.
If the problem still exists there, please provide a minimal test application and steps to reproduce.
Those should be always included in such a report.

@PascalDragon and others, please ask people to test with trunk before reporting. There are countless small improvements compared to the 2.0.x series.
The difference is now particularly big because the release was delayed. (FPC project has the same problem often.)
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

PascalDragon

  • Hero Member
  • *****
  • Posts: 5444
  • Compiler Developer
Re: Kind of Error in TFPWebModule
« Reply #9 on: July 11, 2021, 01:17:57 pm »
@PascalDragon and others, please ask people to test with trunk before reporting. There are countless small improvements compared to the 2.0.x series.
The difference is now particularly big because the release was delayed. (FPC project has the same problem often.)

Will do so. :)

 

TinyPortal © 2005-2018