@ardimedia/angular-portal-azure 0.2.196 → 0.2.198

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/apn.d.ts +3 -1
  2. package/apn.js +55 -15
  3. package/package.json +1 -1
package/apn.d.ts CHANGED
@@ -420,7 +420,9 @@ declare namespace angularportalazure {
420
420
  StatusText: string | undefined;
421
421
  Url: string;
422
422
  static prepareException(response: angular.IHttpPromiseCallbackArg<angularportalazure.Exception> | any): angularportalazure.Exception;
423
- private static processDotNetException(response);
423
+ private static processDotNetException1(response);
424
+ private static processDotNetException2(response);
425
+ private static setExceptionType(response, exception);
424
426
  }
425
427
  }
426
428
  declare namespace angularportalazure {
package/apn.js CHANGED
@@ -1378,19 +1378,37 @@ var angularportalazure;
1378
1378
  }
1379
1379
  //#endregion
1380
1380
  //#region Methods
1381
- // [any] will be [Response] in angular2
1381
+ // TODO:2017-01-09/hp: [any] will be [Response] in angular2
1382
1382
  Exception.prepareException = function (response) {
1383
1383
  console.log('convertException: input [angular.IHttpPromiseCallbackArg<angularportalazure.Exception>]');
1384
1384
  console.log(response);
1385
- var exception = Exception.processDotNetException(response.data);
1386
- exception.ExceptionType = response.data.ExceptionType;
1387
- exception.Type = response.data.Type;
1388
- exception.Message = response.data.Message;
1389
- exception.MessageDetail = response.data.MessageDetail;
1390
- exception.Messages = response.data.Messages;
1391
- exception.Url = response.config.url;
1392
- exception.Status = response.status;
1393
- exception.StatusText = response.statusText;
1385
+ var exception = new angularportalazure.Exception();
1386
+ if (response.headers === undefined) {
1387
+ exception = Exception.processDotNetException1(response.data);
1388
+ exception.ExceptionMessage = response.data.ExceptionMessage;
1389
+ exception.StackTrace = response.data.StackTrace;
1390
+ exception.ExceptionType = response.data.ExceptionType;
1391
+ exception.Type = response.data.Type;
1392
+ exception.Message = response.data.Message;
1393
+ exception.MessageDetail = response.data.MessageDetail;
1394
+ exception.Messages = response.data.Messages;
1395
+ exception.Url = response.config.url;
1396
+ exception.Status = response.status;
1397
+ exception.StatusText = response.statusText;
1398
+ }
1399
+ else {
1400
+ exception = Exception.processDotNetException2(response.data);
1401
+ exception.ExceptionMessage = response.json().ExceptionMessage;
1402
+ exception.StackTrace = response.json().StackTrace;
1403
+ Exception.setExceptionType(response, exception);
1404
+ exception.Type = response.json().Type;
1405
+ exception.Message = response.json().Message;
1406
+ exception.MessageDetail = response.json().MessageDetail;
1407
+ exception.Messages = response.json().Messages;
1408
+ exception.Url = response.url;
1409
+ exception.Status = response.status;
1410
+ exception.StatusText = response.statusText;
1411
+ }
1394
1412
  //// Find a better way to log information, maybe to the database or to Google Analytics.
1395
1413
  //console.log('processException:');
1396
1414
  //console.log(response);
@@ -1399,9 +1417,9 @@ var angularportalazure;
1399
1417
  console.log(exception);
1400
1418
  return exception;
1401
1419
  };
1402
- Exception.processDotNetException = function (response) {
1420
+ Exception.processDotNetException1 = function (response) {
1403
1421
  var exception = new angularportalazure.Exception();
1404
- //#region Process data to Messages
1422
+ //#region Convert data to Messages
1405
1423
  exception.Messages = [];
1406
1424
  var i = 1;
1407
1425
  while (response.data[i + ''] !== undefined) {
@@ -1411,22 +1429,44 @@ var angularportalazure;
1411
1429
  //#endregion
1412
1430
  //#region Process DbEntityValidationException
1413
1431
  if (response.data.ExceptionType === 'System.Data.Entity.Validation.DbEntityValidationException') {
1414
- exception.Type = 'DbEntityValidationException';
1432
+ exception.ExceptionType = 'DbEntityValidationException';
1415
1433
  }
1416
1434
  //#endregion
1417
1435
  //#region Process DbUpdateConcurrencyException
1418
1436
  if (response.data.ExceptionType === 'System.Data.Entity.Infrastructure.DbUpdateConcurrencyException') {
1419
- exception.Type = 'DbUpdateConcurrencyException';
1437
+ exception.ExceptionType = 'DbUpdateConcurrencyException';
1420
1438
  }
1421
1439
  //#endregion
1422
1440
  //#region Process ValidationsException
1423
1441
  // ClassName should by ExceptionType
1424
1442
  if (response.data.ClassName.indexOf('ValidationsException') > 0) {
1425
- exception.Type = 'ValidationsException';
1443
+ exception.ExceptionType = 'ValidationsException';
1426
1444
  }
1427
1445
  //#endregion
1428
1446
  return exception;
1429
1447
  };
1448
+ // TODO:2017-01-09/hp: Implement this function for angular2
1449
+ Exception.processDotNetException2 = function (response) {
1450
+ var exception = new angularportalazure.Exception();
1451
+ console.log('[angularportalazure.Exception.processDotNetException2] not yet implemented.');
1452
+ return exception;
1453
+ };
1454
+ Exception.setExceptionType = function (response, exception) {
1455
+ if (response.data.ExceptionType === 'System.Data.Entity.Validation.DbEntityValidationException') {
1456
+ exception.ExceptionType = 'DbEntityValidationException';
1457
+ return;
1458
+ }
1459
+ else if (response.data.ExceptionType === 'System.Data.Entity.Infrastructure.DbUpdateConcurrencyException') {
1460
+ exception.ExceptionType = 'DbUpdateConcurrencyException';
1461
+ return;
1462
+ }
1463
+ else if (response.data.ClassName.indexOf('ValidationsException') > 0) {
1464
+ // ClassName should by ExceptionType
1465
+ exception.ExceptionType = 'ValidationsException';
1466
+ return;
1467
+ }
1468
+ exception.ExceptionType = response.data.ExceptionType;
1469
+ };
1430
1470
  return Exception;
1431
1471
  }(angularportalazure.ValidationsExceptionDotNet));
1432
1472
  angularportalazure.Exception = Exception;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@ardimedia/angular-portal-azure",
3
3
  "description": "Angular Portal Azure - GUI Framework.",
4
4
  "author": "Ardimedia Anstalt <info@ardimedia.com> (http://www.ardimedia.com)",
5
- "version": "0.2.196",
5
+ "version": "0.2.198",
6
6
  "main": "index.js",
7
7
  "typings": "apn.d.ts",
8
8
  "dependencies": {