WSError()
This feature is not supported on the Wolfram Cloud.

int WSError(WSLINK link)
returns a value identifying the last error to occur on link. WSError() returns WSEOK if no error has occurred since the previous call to WSClearError().

DetailsDetails

  • You can get a textual description of errors by calling WSErrorMessage().
  • WSError() can return the following values:
  • WSEOKeverything is OK
    WSEDEADlink died
    WSEGBADinconsistent data read
    WSEGSEQWSGet() function called out of sequence
    WSEPBTKWSPutNext() passed a bad token
    WSEPSEQWSPut() function called out of sequence
    WSEPBIGWSPutData() given too much data
    WSEOVFLmachine number overflow
    WSEMEMout of memory
    WSEACCEPTfailure to accept socket connection
    WSECONNECTa deferred connection is still unconnected
    WSEPUTENDPACKETunexpected or missing call of WSEndPacket()
    WSENEXTPACKETWSNextPacket() called while the current packet has unread data
    WSEUNKNOWNPACKETWSNextPacket() read in an unknown packet head
    WSEGETENDPACKETunexpected end of packet
    WSEABORTa put or get was aborted before affecting the link
    WSECLOSEDthe other side of the link closed the connection (you may still receive undelivered data)
    WSEINITthe WSTP environment was not initialized
    WSEARGVinsufficient arguments to open the link
    WSEPROTOCOLprotocol unavailable
    WSEMODEmode unavailable
    WSELAUNCHlaunch unsupported
    WSELAUNCHAGAINcannot launch the program again from the same file
    WSELAUNCHSPACEinsufficient space to launch the program
    WSENOPARENTno parent available for connection
    WSENAMETAKENthe linkname was already in use
    WSENOLISTENthe linkname was found not to be listening
    WSEBADNAMEthe linkname was missing or not in the proper form
    WSEBADHOSTthe location was unreachable or not in the proper form
    WSELAUNCHFAILEDthe program failed to launch because a resource or library was missing
    WSELAUNCHNAMEthe launch failed because the program could not be found
    WSEPSCONVERTunable to convert from given character encoding to link encoding
    WSEGSCONVERTunable to convert from link encoding to requested encoding
    WSEPDATABADcharacter data in given encoding incorrect
    WSENOTEXEspecified file is not a WSTP executable
    WSESYNCOBJECTMAKEunable to create WSTP synchronization object
    WSEBACKOUTyield function terminated WSTP operation
    WSEBADOPTSYMunable to recognize symbol value on link
    WSEBADOPTSTRunable to recognize string value on link
    WSENEEDBIGGERBUFFERfunction call needs bigger buffer argument
  • WSError() is declared in the WSTP header file wstp.h.

ExamplesExamplesopen allclose all

Basic Examples  (1)Basic Examples  (1)

#include "wstp.h"

/* send the integer 10 to a link */

void f(MLINK lp)
{
    if(! WSPutInteger(lp, 10))
    {
        /* check the possible errors */
        switch(WSError(lp))
        {
            case MLEDEAD:
                /* the link died unexpectedly */
                break;
            case MLECLOSED:
                /* the other side closed the link */
                break;
            case MLEOK:
                /* no error occurred */
                break;
            default:
                /* ... */
        }
    }
}