@@ -41,30 +41,30 @@ translationType: machine
41
41
### Java [ #android-syntax-java]
42
42
43
43
``` java
44
- NewRelic . recordHandledException(Exception $exceptionToHandle)
45
- NewRelic . recordHandledException(Exception $exceptionToHandle, Map of String , Object $exceptionAttributes)
44
+ NewRelic . recordHandledException(Exception $exceptionToHandle)
45
+ NewRelic . recordHandledException(Exception $exceptionToHandle, Map of String , Object $exceptionAttributes)
46
46
```
47
47
48
48
``` java
49
- NewRelic . recordHandledException(Throwable $throwableToHandle)
50
- NewRelic . recordHandledException(Throwable $throwableToHandle, Map of String , Object $exceptionAttributes)
49
+ NewRelic . recordHandledException(Throwable $throwableToHandle)
50
+ NewRelic . recordHandledException(Throwable $throwableToHandle, Map of String , Object $exceptionAttributes)
51
51
```
52
52
53
53
### Kotlin [ #android-syntax-kotlin]
54
54
55
55
``` kotlin
56
- NewRelic .recordHandledException(
57
- exception: Exception ? ,
58
- exceptionAttributes: Map <String ?, Any ?>?
59
- )
56
+ NewRelic .recordHandledException(
57
+ exception: Exception ? ,
58
+ exceptionAttributes: Map <String ?, Any ?>?
59
+ )
60
60
```
61
61
62
62
``` kotlin
63
- NewRelic .recordHandledException(throwable: Throwable ? )
64
- NewRelic . recordHandledException(
65
- throwable: Throwable ? ,
66
- attributes: Map <String ?, Any ?>?
67
- )
63
+ NewRelic .recordHandledException(throwable: Throwable ? )
64
+ NewRelic . recordHandledException(
65
+ throwable: Throwable ? ,
66
+ attributes: Map <String ?, Any ?>?
67
+ )
68
68
```
69
69
70
70
## Descripción [ #android-description]
@@ -136,43 +136,42 @@ translationType: machine
136
136
### Java [ #android-examples-java]
137
137
138
138
``` java
139
- public class MainActivity extends Activity {
140
- ...
141
- coolButton.setOnClickListener (new View .OnClickListener () {
142
- Map myMap = new HashMap<> ();
143
- @Override
144
- public void onClick(View view) {
145
- try {
146
- myMap. put(" Key" , " Value" );
147
- Integer stringVar = (Integer ) myMap. get(" Key" ); // throws ClassCastException
148
- } catch (Exception e) {
149
- NewRelic . recordHandledException(e, myMap);
150
- }
151
- }
152
- });
153
- ...
139
+ public class MainActivity extends Activity {
140
+ ... coolButton.setOnClickListener (new View .OnClickListener () {
141
+ Map myMap = new HashMap<> ();
142
+ @Override
143
+ public void onClick(View view) {
144
+ try {
145
+ myMap. put(" Key" , " Value" );
146
+ Integer stringVar =
147
+ (Integer ) myMap. get(" Key" ); // throws ClassCastException
148
+ } catch (Exception e) {
149
+ NewRelic . recordHandledException(e, myMap);
154
150
}
151
+ }
152
+ });
153
+ ...
154
+ }
155
155
```
156
156
157
157
### Kotlin [ #android-examples-kotlin]
158
158
159
159
``` kotlin
160
-
161
- class MainActivity : AppCompatActivity () {
162
-
163
- ....
164
- binding.fab.setOnClickListener { view ->
165
- val myMap = mutableMapOf<String ,Any >()
166
- try {
167
- myMap[" Key" ] = " Value"
168
- Snackbar .make(view, " Replace with your own action" , Snackbar .LENGTH_LONG )
169
- .setAnchorView(R .id.fab)
170
- .setAction(" Action" , null ).show()
171
- }catch (exception: Exception ) {
172
- NewRelic .recordHandledException(exception,myMap)
173
- }
174
- }
175
- ........
160
+ class MainActivity : AppCompatActivity () {
161
+ .. .
162
+ binding.fab.setOnClickListener { view ->
163
+ val myMap = mutableMapOf<String ,Any >()
164
+ try {
165
+ myMap[" Key" ] = " Value"
166
+ Snackbar .make(view, " Replace with your own action" , Snackbar .LENGTH_LONG )
167
+ .setAnchorView(R .id.fab)
168
+ .setAction(" Action" , null ).show()
169
+ }catch (exception: Exception ) {
170
+ NewRelic .recordHandledException(exception,myMap)
171
+ }
172
+ }
173
+ .. .
174
+ }
176
175
```
177
176
</TabsPageItem >
178
177
@@ -182,7 +181,7 @@ translationType: machine
182
181
### C objetivo
183
182
184
183
``` objectivec
185
- recordHandledException: (NSException * __nonnull )exception withAttributes: (NSDictionary * __nullable )attributes;
184
+ recordHandledException:(NSException * __nonnull)exception withAttributes:(NSDictionary * __nullable)attributes;
186
185
```
187
186
188
187
## Descripción [ #ios-description]
@@ -256,32 +255,33 @@ translationType: machine
256
255
A continuación se muestra un ejemplo de una excepción manejada simple:
257
256
258
257
``` objectivec
259
- @ try {
260
- @throw [NSException exceptionWithName: @" versionException"
261
- reason: @" App version no longer supported"
262
- userInfo: nil];
263
- } @catch (NSException * e) {
264
- [NewRelic recordHandledException: e];
265
- }
258
+ try {
259
+ @throw [ NSException exceptionWithName:@"versionException"
260
+ reason:@"App version no longer supported"
261
+ userInfo:nil] ;
262
+ } @catch (NSException* e) {
263
+ [NewRelic recordHandledException :e ];
264
+ }
266
265
```
267
266
268
267
Aquí hay otro ejemplo o una excepción manejada con un diccionario:
269
268
270
269
``` objectivec
271
- NSException * exception = [NSException exceptionWithName: @" MyException" reason: @" I have my reason" userInfo: nil];
272
-
273
- NSDictionary * dictionary = @{@" int" : @1 ,
274
- @" Test Group" : @" A | B" };
275
-
276
- [NewRelic recordHandledException: exception withAttributes: dictionary];
270
+ NSException * exception = [NSException exceptionWithName: @"MyException"
271
+ reason:@"I have my reason"
272
+ userInfo:nil] ;
273
+
274
+ NSDictionary* dictionary = @{ @" int" : @1 , @" Test Group" : @" A | B" } ;
275
+
276
+ [ NewRelic recordHandledException:exception withAttributes:dictionary] ;
277
277
```
278
278
</TabsPageItem >
279
279
280
280
<TabsPageItem id = " maui" >
281
281
## Sintaxis [ #maui-syntax]
282
282
283
283
``` csharp
284
- recordError(error, StackTrace .current, attributes: attributes);
284
+ recordError (error , StackTrace .current , attributes : attributes );
285
285
```
286
286
287
287
## Descripción [ #maui-description]
@@ -331,20 +331,20 @@ translationType: machine
331
331
## Ejemplo [ #maui-example]
332
332
333
333
``` dart
334
- try {
335
- some_code_that_throws_error();
336
- } catch (ex) {
337
- NewrelicMobile .instance
338
- .recordError(error, StackTrace .current, attributes: attributes);
339
- }
334
+ try {
335
+ some_code_that_throws_error();
336
+ } catch (ex) {
337
+ NewrelicMobile.instance
338
+ .recordError(error, StackTrace.current, attributes: attributes);
339
+ }
340
340
```
341
341
</TabsPageItem >
342
342
343
343
<TabsPageItem id = " unity" >
344
344
## Sintaxis [ #unity-syntax]
345
345
346
346
``` csharp
347
- RecordException (System .Exception exception) : void;
347
+ RecordException (System .Exception exception ) : void ;
348
348
```
349
349
350
350
## Descripción [ #unity-description]
@@ -394,19 +394,19 @@ translationType: machine
394
394
## Ejemplo [ #unity-example]
395
395
396
396
``` csharp
397
- try {
398
- some_code_that_throws_error();
399
- } catch (Exception ex) {
400
- CrossNewRelic .Current .RecordException (ex);
401
- }
397
+ try {
398
+ some_code_that_throws_error ();
399
+ } catch (Exception ex ) {
400
+ CrossNewRelic .Current .RecordException (ex );
401
+ }
402
402
```
403
403
</TabsPageItem >
404
404
405
405
<TabsPageItem id = " xamarin" >
406
406
## Sintaxis [ #xamarin-syntax]
407
407
408
408
``` csharp
409
- RecordException (System .Exception exception) : void;
409
+ RecordException (System .Exception exception ) : void ;
410
410
```
411
411
412
412
## Descripción [ #xamarin-description]
@@ -456,11 +456,11 @@ translationType: machine
456
456
## Ejemplo [ #xamarin-example]
457
457
458
458
``` csharp
459
- try {
460
- some_code_that_throws_error();
461
- } catch (Exception ex) {
462
- NewRelicAgent .RecordException (e);
463
- }
459
+ try {
460
+ some_code_that_throws_error ();
461
+ } catch (Exception ex ) {
462
+ NewRelicAgent .RecordException (e );
463
+ }
464
464
```
465
465
</TabsPageItem >
466
466
</TabsPages >
0 commit comments