You try to upload a file and JS Code a the same time during your SUBMIT action.
so your &js< ...> lands every 32000 characters inside your file.

&js<..> is just a hidden WRITE and allows javascript syntax checking inside the <.. >

example:

&js<alert('Unable to create user.');> 

is identic to 

Write "alert('Unable to create user.');",!

So your concept doesn't work that way
You would require a second independent JS routine in a browser to call for progress using CSP hyperevent.

method %ProcessError should output the real error but what you see is the result of ZT "JGTW"

Method %ProcessError(
fun As %String,
msgid As %Integer) [ Final ]
{
Use ..Gateway.GatewayDevice 
If fun="Y9" Do ..%ReadObjects(..Gateway) Quit
Set error=$zobjexport(12)
Set x=$$$ERROR($$$RemoteGatewayError,error)   
Use ..Gateway.CurrentDevice
Zt "JGTW"
}

 

Your error lands in the highlighted line. But as the method is FINAL you can't overload it.
Your original class System.Object might be a less restricted copy.

In addition, I see ZTRAP command this may explain why Try / Catch didn't react as expected.  

I was unable to identify the class System.Object you inherit for your proxy object.

But the methods you call are all available in  %Net.Remote.Proxy

so verify the definition of System.Object
or change your class to

Class writetofile.WriteFile Extends  %Net.Remote.Proxy  ProcedureBlock ]

I think you fail in %OnNew() in ..%Constructor(..)

I might be worth for testing to replace

Quit ..%Constructor(p0,"writetofile.WriteFile",0)

by 

Try {
     set obj=..%Constructor(p0,"writetofile.WriteFile",0)
}
Catch erroor  {.....   set obj=""}

Quit obj

you miss a check in your code

Set conn ##class(%Net.Remote.Gateway).%New()  // No error here
Set tSC conn.%Connect("127.0.0.1""55000""NETTEST"// No error here
 IF 'tSC  ...........  // check if connection was succesful
Set api ##class(writetofile.WriteFile).%New(conn) //Here comes the error
set strFile "d:\temp\example.txt"
set strInput "Hello world"
set ret api.FilePut(strFile,strInput)
Set tSC conn.%Disconnect()

Your connection may have failed, so next call will fail too, 

Was it the same machine?
+ a clean shutdown in 2015 ? 

Mounting your DB from Terminal "%SYS" may give you a better error message.

%SYS>d ^DATABASE
 
 1) Create a database
 2) Edit a database
 3) List databases
 4) Delete a database
 5) Mount a database
 6) Dismount a database
 7) Compact globals in a database
 8) Show free space for a database
 9) Show details for a database
10) Recreate a database
11) Manage database encryption
12) Return unused space for a database
13) Compact free space in a database
14) Defragment globals in a database
 

Hi Eduard,
I did something similar in past
only difference:

  • used #q1c1#  to make sure placeholders are embedded and don't conflict  with the real text
  • my table was in HTML with default row visibility HIDDEN
    only with actual content, it was set to VISIBLE.
    This allowed also to skip rows and have not only uniform rows
    and I could also play with styles.

Whatever OS you use you will need some driver-like code to control the state of the connection at HW level.

Next COS may listen on a TCP or UDP port or poll the driver on a regular base.
Dependent on the intelligence of the driver it may even start an appropriate sessiom from the command line. 
Or run a call-in to Caché over the published interface.

But it is always some code external to Cache´to handle the HW. 

Hi Ben,

from the hacker's toolbox:

Parameter MAXSTACK = 15;
Trigger TUpdateFoobar [ Event = INSERT/UPDATE, Foreach = row/object, Time = AFTER ]
{
  Try {
    // get value of Foobar
    NEW fb
    SET fb= {Foobar}
    IF $STACK > ..#MAXSTACK {
     // just for debugging
     wwrite "***",$STACK
         // INSERT value into embedded Primary Environments
         &sql(UPDATE ContainerObj (InnerObj_Foobar) 
              VALUES (:fb)
              WHERE %ID=:{ID})
    }
} Catch tError {
Do LOG^%ETN
Throw tError
}
}

You have to find out by "hacking"  a suitable value for MAXSTACK related to your application.
Inside the looping Trigger, there is no chance to identify the first run of the loop.

If you know a %variable (e.g. %BenMax) you may use it as well.
You only have to make sure it is initialized outside your trigger.  

IF $i(%BenMax) > ..#MAXSTACK {

With SQL you can initial %BenMax by a static (independent of row) WHERE Condition 

 INSERT ..... WHERE my.BENMAX()=1 and ....

The ClassMethod BENMAX may look like this:

ClassMethod BenMax(As %Integer = 1 ) As %Integer [ SqlName = BENMAX ]
{       set %BenMax=$s(n:n,1:1) quit 1    }

David,
I digged a little bit following your hint into Eclipse.

menu Windows / Prefernces (by user !) presented this image  


and this is the content of storage_location 

#Equinox secure storage version 1.0
#Fri May 25 19:54:27 CEST 2018
/com.intersystems.atelier.connmgr/ENS/port=\t,NTc3NzQ\=
/com.intersystems.atelier.connmgr/ENS/ssl=\t,ZmFsc2U\=
/com.intersystems.atelier.connmgr/2016-2/user=\t,cmNlbXBlcg\=\=
/com.intersystems.atelier.connmgr/2016-2/pass=org.eclipse.equinox.security.windowspasswordprovider64bit\tw+5qObI6N8Y\=,FVLqyPMCkoqq6Q7jjl0Wyw\=\=
/com.intersystems.atelier.connmgr/ENS/host=\t,bG9jYWxob3N0
/com.intersystems.atelier.connmgr/2016-2/ssl=\t,ZmFsc2U\=
/org.eclipse.equinox.secure.storage/verification/org.eclipse.equinox.security.windowspasswordprovider64bit=org.eclipse.equinox.security.windowspasswordprovider64bit\tvhjCbjyiXyI\=,kN4AlU0D0lskPVn+ZkduJBzTJLtNI69y
org.eclipse.equinox.security.preferences.keyFactory=PBEWithMD5AndDES
/com.intersystems.atelier.connmgr/2016-2/port=\t,NTc3NzI\=
/org.eclipse.equinox.secure.storage/windows64/encryptedPassword=\t,QVFBQUFOQ01uZDhCRmRFUmpIb0F3RS9DbCtzQkFBQUFITms3N0Z1ZTVVZTZuY1JuZUpLT0pnQUFBQUFRQUFBQVJRQnhBSFVBYVFCdUFHOEFlQUFBQUJCbUFBQUFBUUFBSUFBQUFMejUrdHB5MnVhUXVmWGIxNloyYm9kZGpNWFliNEFRdHBickJodnlwU0pPQUFBQUFBNkFBQUFBQWdBQUlBQUFBTHFOWmFFNUhnWTdBNytjRFhoQ1d5NVdIajJGcVJkVWNJTjVhS2l1NkVlQVlBRUFBSnRlODlWYWVkSFdLREh0OHY1aFhrc1NyL2RwaFVoWFV3V2RJNDdraXFhZk9RdVowK3ZVdUk4bzJFOUNwL2JtS2Q5YVc3WG9mN0YrQlBjOWhja0R1UXRWbzB3QkRuQkM4SW5MTWh1L2haVTNHRmhGODQxUEZSZHhOeDlVMmRjU0tFcXZtZEpVSXlQbjJZWWlEUWpMV2JnVEZ0Z1NlajVVV1RldUxPWEFUaXRSMDBqM1hTWjB0ZmlDK2ZlVE8rVEtIa3VkTnZXZGNBNS9UQ2gydDhOUEVWRHljd2F6WjVkK3IyOVdjS1BjVlNNaXFUTVZMR1FFdlB3M1ZPTUhhSVVUNTR4SEVOV3dncndJZ0J2S0JVU3NHVVVNSER2dE44MUJUNUEvVnc1TVR6VmMyNWkwUk4wandtRzUvSWJyaHhVSy81STFwanhaL0czRFJ1eGlZZWhpQkREM3JRTzdPSE5lVlRxdmk0bSt2cUxoQlUxYi9LcVNqSkNFMktLa2RGby9vaDRMeGJscHdhcHFOa09maURLZi8yVmpnTkd1UTRyVEJnVEIxSUpBRFA0TExZMWJyeUttV0dicE5adG1xRDBpVURCc3BQQ3FmOUh0L1BBSHV3a1lNUTFBQUFBQUkyS2RnYjVSajhXYmxSd0xXdGZZZndodmJ4eDFDR2tZYy9UNWI2eThLZFdrOUJSdTV6VzRneC9WTjVwemRTaVl0UjZnZVVBQmdHSkE0OVI3YXg5amxRPT0\=
/com.intersystems.atelier.connmgr/ENS/user=\t,cmNlbXBlcg\=\=
/org.eclipse.equinox.secure.storage/recovery/org.eclipse.equinox.security.windowspasswordprovider64bit/org.eclipse.equinox.security.internal.recovery.question2=\t,cHJlZmVycmVkIGJhbmQ\=
/org.eclipse.equinox.secure.storage/recovery/org.eclip
se.equinox.security.windowspasswordprovider64bit/org.eclipse.equinox.security.internal.recovery.question1=\t,bW90aGVyJ3MgbmFtZQ\=\=
/com.intersystems.atelier.connmgr/ENS/pass=org.eclipse.equinox.security.windowspasswordprovider64bit\tp9QyPCw3qvU\=,ZefLoWUenz48mT11jp1crA\=\=
org.eclipse.equinox.security.preferences.cipher=PBEWithMD5AndDES
/com.intersystems.atelier.connmgr/2016-2/host=\t,bG9jYWxob3N0
org.eclipse.equinox.security.preferences.version=1
/org.eclipse.equinox.secure.storage/recovery/org.eclipse.equinox.security.windowspasswordprovider64bit/org.eclipse.equinox.security.internal.recovery.password=org.eclipse.equinox.security.recoveryModule\tA0LP4JVoFdk\=,SzaccA06wSF+uh0AtcUhHwSgaGG6D2zZ1NOTJsm/ulkjaBmWAppasPrnkWJgOJb6C5insCpZcCyHKNPOOSKLXb1kuxkPDHo++9aEGbFxlbpmCO4p483ToK25KXgV0E+Gj5u4EPsHpsYvb4L4wAtyeESf0gZnbxKim3YqsFrim1SEuZKGoZH3QjYWxM0auPlFwnvgyK6RwfyznDbHvvWTtl4G3Hq4B1X3+cbqOdrkanDCjYFsQ2eutlddFe52AId+kqg1TplQL51PQFILIxHjg2LRmp2Qol321Oex7Oqk1iiddZmTeY/ToBTEzJCCdr1JbGIY5Pi3XJ3NRGyRF0rAsYC46+m6T3NmJsNid6I/V3t5BaOvFsxxfjfs9XXJ25RRWY6OiHbkp/dwsMaEMjy0zkEI3B4qvXOc7Gbf5wGyR9dXsqLEv2LzlDDY8Ne/kWU2v6J6S59EdU8\=
 

I doubt that without hijacking your (Windows ?) account this can NOT be misused.
 

Ruslan,

After execution, the JOB Command sets system variable $ZCHILD

$ZCHILD contains the ID of the last child process that the current process created with the JOB command. If your process has not used JOB to create a child process, $ZCHILD returns 0 (zero).

$ZCHILD being set does not mean that the job was successfully started. It only means that the process was created and the parameters were passed successfully.

Now you have the OIID in hands to apply to $System.Process.Terminate(bgjob) as suggested already by  Vitaliy Serdtsev