Repository.XFRACAS.WriteExceptionToDiagnosticsLog: Difference between revisions

From ReliaWiki
Jump to navigation Jump to search
No edit summary
Line 1: Line 1:
{{Template:APIClass|Repository Class|Repository}}
{{DISPLAYTITLE:Repository.XFRACAS.WriteExceptionToDiagnosticsLog Method}}{{Template:API}}{{Template:APIBreadcrumb|9|.[[Repository Class|Repository]]}}
{{Template:Repository.WriteToDiagnosticsLog (System.Exception,mXFRACASDiagnosticEntryType, String).Cmt}}
 
 
<onlyinclude>Writes exception information to the XFRACAS diagnostics log.</onlyinclude>


== Syntax ==
== Syntax ==
*WriteToDiagnosticsLog(exObject {{APIPrefix|As}} System.Exception , entrytype {{APIPrefix|As}} [[Repository.XFRACASDiagnosticEntryType|XFRACASDiagnosticEntryType]], {{APIPrefix| Optional}} comment{{APIPrefix|As String}})
'''.WriteExceptionToDiagnosticsLog''' (''exObject'', ''entryType'', ''comment'')
 
===Parameters===
''exObject''
 
:Required. Exception. Represents the error that occurred during application execution.
 
''entryType''
 
:Required. The XFRACAS diagnostics type. Can be any [[XFRACASDiagnosticsEntryType Enumeration|XFRACASDiagnosticsEntryType]] enumeration.
 
''comment''
:Optional. String. The text to write to the XFRACAS diagnostics log.
 


Parameters
== Example ==
:''exObject'': Represents an error that occurs during application execution
The following example demonstrates
:''entryType'': The type of diagnostics entry type, specified as [[XFRACASDiagnosticsEntryType Enumeration|XFRACASDiagnosticsEntryType]]
:''comment'': ''Optional'' comment to write to the diagnostics log


= Usage Example =
'''VB.NET'''
  {{APIComment|'Connect to the Synthesis repository.}}
  {{APIPrefix|Dim}}Success{{APIPrefix|As Boolean}}= MyRepository.[[Repository.ConnectToRepository|ConnectToRepository]]("RepositoryFileNamePath")
  {{APIComment|'Connect to the Synthesis repository. The following code}}
  {{APIComment|'Get the list of XFRACAS Entities in the current project in the connected repository.}}
  {{APIComment|'assumes that a file called "RSRepository1.rsr10" exists in the C: drive.}}
{{APIPrefix|If}}success{{APIPrefix|Then}}
  {{APIPrefix|Dim}} MyRepository {{APIPrefix|As New}} Repository
      MyRepository.XFRACAS.WriteMessageToDiagnosticsLog("Successfully connected to repository", SynthesisAPI.[[XFRACASDiagnosticsEntryType Enumeration|XFRACASDiagnosticsEntryType]].Information)  
  {{APIPrefix|Dim}} Success {{APIPrefix|As}} Boolean
    {{APIPrefix|Try}}
  Success = MyRepository.ConnectToRepository ({{APIString|"C:\RSRepository1.rsr10"}})
        {{APIPrefix|Dim}}ListOfXFRACASEntities(){{APIPrefix|As}}SynthesisAPI.[[NameIdPair Class|NameIdPair]] = MyRepository.XFRACAS.[[Repository.GetAllXFRACASEntities|GetAllXFRACASEntities]]()
        {{APIPrefix|For}}i{{APIPrefix|As Integer}}= 0{{APIPrefix|To}}ListOfXFRACASEntities.GetUpperBound(0)
  {{APIComment|'Record a message to diagnostic log if the connection to the repository is successful.}}
              MessageBox.Show(ListOfXFRACASEntities(i).Name)
  {{APIPrefix|If}} Success {{APIPrefix|Then}}
        {{APIPrefix|Next}}
  MyRepository.XFRACAS.WriteMessageToDiagnosticsLog({{APIString|"Successfully connected to repository"}}, XFRACASDiagnosticsEntryType.Information)
    {{APIPrefix|Catch}}ex{{APIPrefix|As}}Exception
        {{APIComment|'Write error message to diagnostics log}}
  {{APIComment|'Get a list of all XFRACAS entities connected to the repository.}}
          MyRepository.XFRACAS.WriteExceptionToDiagosticsLog(ex, SynthesisAPI.[[XFRACASDiagnosticsEntryType Enumeration|XFRACASDiagnosticsEntryType]].Error, "Reading Entities")
  {{APIPrefix|Try}}
    {{APIPrefix|End Try}}
      {{APIPrefix|Dim}} ListOfXFRACASEntities() {{APIPrefix|As}} NameIdPair
      ListofXFRACASEntities = MyRepository.XFRACAS.GetAllXFRACASEntities
      {{APIPrefix|Dim}} i {{APIPrefix|As}} Integer
      {{APIPrefix|For}} i = 0 {{APIPrefix|To}} ListOfXFRACASEntities.GetUpperBound(0)
            MessageBox.Show(ListOfXFRACASEntities(i).Name)
      {{APIPrefix|Next}}  
  {{APIPrefix|Catch}} Ex {{APIPrefix|As}} Exception
    {{APIComment|'Write error message to diagnostics log.}}
      MyRepository.XFRACAS.WriteExceptionToDiagosticsLog(Ex, XFRACASDiagnosticsEntryType.Error, {{APIPrefix|"Reading Entities"}})
  {{APIPrefix|End Try}}
  {{APIPrefix|End If}}
  {{APIPrefix|End If}}

Revision as of 21:05, 28 October 2015

APIWiki.png


Member of: SynthesisAPI9.Repository


Writes exception information to the XFRACAS diagnostics log.

Syntax

.WriteExceptionToDiagnosticsLog (exObject, entryType, comment)

Parameters

exObject

Required. Exception. Represents the error that occurred during application execution.

entryType

Required. The XFRACAS diagnostics type. Can be any XFRACASDiagnosticsEntryType enumeration.

comment

Optional. String. The text to write to the XFRACAS diagnostics log.


Example

The following example demonstrates

VB.NET

 'Connect to the Synthesis repository. The following code 
 'assumes that a file called "RSRepository1.rsr10" exists in the C: drive. 
  Dim MyRepository As New Repository
  Dim Success As Boolean
  Success = MyRepository.ConnectToRepository ("C:\RSRepository1.rsr10")

 'Record a message to diagnostic log if the connection to the repository is successful. 
  If Success Then
  MyRepository.XFRACAS.WriteMessageToDiagnosticsLog("Successfully connected to repository", XFRACASDiagnosticsEntryType.Information)

  'Get a list of all XFRACAS entities connected to the repository.  
  Try
     Dim ListOfXFRACASEntities() As NameIdPair
     ListofXFRACASEntities = MyRepository.XFRACAS.GetAllXFRACASEntities

     Dim i As Integer
     For i = 0 To ListOfXFRACASEntities.GetUpperBound(0)
           MessageBox.Show(ListOfXFRACASEntities(i).Name)
     Next 

  Catch Ex As Exception
     'Write error message to diagnostics log. 
     MyRepository.XFRACAS.WriteExceptionToDiagosticsLog(Ex, XFRACASDiagnosticsEntryType.Error, "Reading Entities")

  End Try
End If