Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 4 of 4 total
Thread Exception message
Thu, Jul 19 2018 7:30 AMPermanent Link

Matthew Jones

I have an odd one here. Sure this has worked before.

   try
       StrToInt('');
   except
       on errInfo : Exception do
       begin
           lblError.Visible := true;
           lblError.Caption := errInfo.Message;
       end;
   end;

The label is actually already visible, but StrToInt throws a string message as the exception. errInfo.Message is undefined, because errInfo is the error string itself.

The help shows:

try
    // Statements that raise exception
 except
    on E: Exception do
       LogOutput(E.Message);
    raise;
 end;

So why is Chrome blowing up on this call to set the caption?

Hmm, the code in strtobool has
 throw new Error(webcore_translate1("ERR_BOOLEAN_LITERAL", [value]));

But strtoint has
throw "Invalid integer value";

(And strtodouble has similar)

That code seems to be an intrinsic, so I can't see the source. Bug?


--

Matthew Jones
Thu, Jul 19 2018 9:09 AMPermanent Link

Michael Dreher

"Matthew Jones" wrote:

 // But strtoint has
 //       throw "Invalid integer value";

That's not new. I've looked in some compiled code from 2016-12, and there StrToInt
already throws a string literal. So on JS level "errInfo" is of type string?

I tried...

  try
      StrToInt('');
  except
      on errInfo : Exception do
      begin
           lblError.Visible := true;
           lblError.Caption := string(variant(errInfo));
      end;
  end;

and it seem to work (for this one).
M. Dreher
Thu, Jul 19 2018 12:15 PMPermanent Link

Matthew Jones

Michael Dreher wrote:

>  lblError.Caption := string(variant(errInfo));

Ahah, well done on getting it to work. I just got compiler errors with what I tried. But obviously is a long standing bug.

--

Matthew Jones
Mon, Jul 23 2018 12:36 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Matthew,

<< The label is actually already visible, but StrToInt throws a string message as the exception. errInfo.Message
is undefined, because errInfo is the error string itself. >>

I'll have a fix for this in the next build (unfortunately, I released a new build this morning before I read this).

Tim Young
Elevate Software
www.elevatesoft.com
Image