BYTEINSIGHT
GAPVelocity AI Studio helps you move from outdated tech stacks to the latest desktop, web, and cloud platforms—smarter, faster, and with less risk.
Choose a platform to see migration options:
Our comprehensive approach to application modernization, from assessment to production deployment.
Transformation Services
Not Sure Where to Start?
This EWI is generated when an error handling statement is too complex or if it is a pattern that is not supported by the VB6 AI Migrator.
Most occurrences of this EWI will require manual changes to the source code to fix the issue. However, most cases of an error label that is globally called within a function can be replaced by a single try { } catch statement with the addition of return statements where appropriate.
The code example illustrates such an example.
PublicFunction ErrorHandlingStatement() AsString
Dim ObjD AsInteger
OnErrorGoTo LabelErr
LabelStart:
ObjD = ErrRaisableSub
LabelExit:
ExitFunction
LabelErr:
If ObjD = 1 Then
Resume LabelStart
Else
Resume LabelExit
EndIf
EndFunction
PublicFunction ErrorHandlingStatement() AsString
Dim ObjD AsInteger
OnErrorGoTo LabelErr
LabelStart:
ObjD = ErrRaisableSub()
LabelExit:
ExitFunction
LabelErr:
If ObjD = 1 Then
Resume LabelStart
Else
Resume LabelExit
EndIf
EndFunction
One way of changing this error patern to ensure functional equivalence is:
PublicFunction ErrorHandlingStatement() AsString
Dim ObjD AsInteger
Try
ObjD = ErrRaisableSub()
Catch
If ObjD <> 1 Then
Return"FAILED"
EndIf
EndTry
Return"OK"
EndFunction
staticpublicstring ErrorHandlingStatement()
{
int ObjD = 0;
//UPGRADE_TODO: (1065) Error handling statement (On Error Goto) could not be converted properly. A throw statement was generated instead.
thrownewException("Migration Exception: 'On Error Goto LabelErr' not supported");
ObjD = ErrRaisableSub();
LabelExit:
return"OK";
LabelErr:
if (ObjD == 1)
{
//UPGRADE_TODO: (1065) Error handling statement (Resume) could not be converted properly. A throw statement was generated instead.
thrownewException("Migration Exception: 'Resume LabelExit' not supported");
}
return"FAILED";
}
One way of changing this error patern to ensure functional equivalence is to do the following changes:
staticpublicstring ErrorHandlingStatement()
{
int ObjD = 0;
try
{
ObjD = ErrRaisableSub();
}
catch (Exception)
{
if (ObjD != 1)
{
return"FAILED";
}
}
return"OK";
}