Libraries.Data.Formats.JavaScriptObjectNotationError Documentation

This class is used to hold the error information while parsing JavaScriptObjectNotation (JSON) formatted data.

Example Code

use Libraries.Data.Formats.JavaScriptObjectNotation
use Libraries.Data.Formats.JavaScriptObjectNotationListener
use Libraries.Data.Formats.JavaScriptObjectNotationToken
use Libraries.Data.Formats.JavaScriptObjectNotationError

private action ThrowError(JavaScriptObjectNotationToken start, 
JavaScriptObjectNotationToken finish,
JavaScriptObjectNotationListener listen,
text message)
if listener not= undefined
    JavaScriptObjectNotationError error
    error:SetLineNumber(start:startLine)
    error:SetColumnNumber(start:startColumn)
    error:SetIndex(start:startIndex)

    if finish not= undefined
        error:SetLineNumberEnd(finish:endLine)
        error:SetColumnNumberEnd(finish:endColumn)
        error:SetIndexEnd(finish:endIndex)
    else 
        error:SetLineNumberEnd(start:endLine)
        error:SetColumnNumberEnd(start:endColumn)
        error:SetIndexEnd(start:endIndex)
    end
    error:SetErrorMessage(message)
    listener:VisitError(error)
end
end

Inherits from: Libraries.Language.Object

Actions Documentation

Compare(Libraries.Language.Object object)

This action compares two object hash codes and returns an integer. The result is larger if this hash code is larger than the object passed as a parameter, smaller, or equal. In this case, -1 means smaller, 0 means equal, and 1 means larger. This action was changed in Quorum 7 to return an integer, instead of a CompareResult object, because the previous implementation was causing efficiency issues.

Parameters

Return

integer: The Compare result, Smaller, Equal, or Larger.

Example

Object o
Object t
integer result = o:Compare(t) //1 (larger), 0 (equal), or -1 (smaller)

Equals(Libraries.Language.Object object)

This action determines if two objects are equal based on their hash code values.

Parameters

Return

boolean: True if the hash codes are equal and false if they are not equal.

Example

use Libraries.Language.Object
use Libraries.Language.Types.Text
Object o
Text t
boolean result = o:Equals(t)

GetColumnNumber()

This method is used to get the ColumnNumber field from a JavaScriptObjectNotationError object

Return

integer: The column number.

Example

use Libraries.Data.Formats.JavaScriptObjectNotationError

action PrintColumnNumber(JavaScriptObjectNotationError error)
    output error:GetColumnNumber()
end

GetColumnNumberEnd()

This method is used to get the ColumnNumberEnd field from a JavaScriptObjectNotationError object

Return

integer: The columnnumber end field.

Example

use Libraries.Data.Formats.JavaScriptObjectNotationError

action PrintColumnNumberEnd(JavaScriptObjectNotationError error)
    output error:GetColumnNumberEnd()
end

GetErrorMessage()

This method is used to get the error message from a JavaScriptObjectNotationError object

Return

text: The error message.

Example

use Libraries.Data.Formats.JavaScriptObjectNotationError

action PrintError(JavaScriptObjectNotationError error)
    output error:GetErrorMessage()
end

GetHashCode()

This action gets the hash code for an object.

Return

integer: The integer hash code of the object.

Example

Object o
integer hash = o:GetHashCode()

GetIndex()

This method is used to get the Index field from a JavaScriptObjectNotationError object

Return

integer: The index value.

Example

use Libraries.Data.Formats.JavaScriptObjectNotationError

action PrintIndex(JavaScriptObjectNotationError error)
    output error:GetIndex()
end

GetIndexEnd()

This method is used to get the IndexEnd field from a JavaScriptObjectNotationError object

Return

integer: The index end value.

Example

use Libraries.Data.Formats.JavaScriptObjectNotationError

action PrintIndexEnd(JavaScriptObjectNotationError error)
    output error:GetIndexEnd()
end

GetLineNumber()

This method is used to get the LineNumber field from a JavaScriptObjectNotationError object

Return

integer: The line number.

Example

use Libraries.Data.Formats.JavaScriptObjectNotationError

action PrintLineNumber(JavaScriptObjectNotationError error)
    output error:GetLineNumber()
end

GetLineNumberEnd()

This method is used to get the LineNumber field from a JavaScriptObjectNotationError object

Return

integer: The line number end value.

Example

use Libraries.Data.Formats.JavaScriptObjectNotationError

action PrintLineNumber(JavaScriptObjectNotationError error)
    output error:GetLineNumber()
end

SetColumnNumber(integer column)

This method is used to set the ColumnNumber field from a JavaScriptObjectNotationError object

Parameters

  • integer column: The column value to set.

Example


use Libraries.Data.Formats.JavaScriptObjectNotationError

action SetColumnNumber(JavaScriptObjectNotationError error, text value)
    output error:SetColumnNumber(value)
end

SetColumnNumberEnd(integer column)

This method is used to set the ColumnNumberEnd field from a JavaScriptObjectNotationError object

Parameters

  • integer column: The column value to set.

Example


use Libraries.Data.Formats.JavaScriptObjectNotationError

action SetColumnNumberEnd(JavaScriptObjectNotationError error, text value)
    output error:SetColumnNumberEnd(value)
end

SetErrorMessage(text value)

This method is used to set the error message from a JavaScriptObjectNotationError object

Parameters

  • text value: The error message to set.

Example

use Libraries.Data.Formats.JavaScriptObjectNotationError

action SetError(JavaScriptObjectNotationError error, text value)
    output error:SetErrorMessage(value)
end

SetIndex(integer index)

This method is used to set the Index field from a JavaScriptObjectNotationError object

Parameters

  • integer index: The index value to set.

Example

use Libraries.Data.Formats.JavaScriptObjectNotationError

action SetIndex(JavaScriptObjectNotationError error, text value)
    output error:SetIndex(value)
end

SetIndexEnd(integer index)

This method is used to set the IndexEnd field from a JavaScriptObjectNotationError object

Parameters

  • integer index: The index value to set.

Example

use Libraries.Data.Formats.JavaScriptObjectNotationError

action SetIndexEnd(JavaScriptObjectNotationError error, text value)
    output error:SetIndexEnd(value)
end

SetLineNumber(integer line)

This method is used to set the LineNumber field from a JavaScriptObjectNotationError object

Parameters

  • integer line: The line value to set.

Example

use Libraries.Data.Formats.JavaScriptObjectNotationError

action SetLineNumber(JavaScriptObjectNotationError error, text value)
    output error:SetLineNumber(value)
end

SetLineNumberEnd(integer line)

This method is used to set the LineNumberEnd field from a JavaScriptObjectNotationError object

Parameters