Skip to content

Commit

Permalink
refactor: Update error URLs
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Some error messages changed, so if you check for error , please double check them now.
  • Loading branch information
sebbo2002 committed Mar 26, 2021
1 parent 546db26 commit 2aedf55
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/alarm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,8 @@ export default class ICalAlarm {
}
else {
throw new Error(
'`attach` needs to be a valid formed string or an object. See https://github.com/sebbo2002/ical-' +
'generator#attachstringobject-attach'
'`attachment` needs to be a valid formed string or an object. See https://sebbo2002.github.io/' +
'ical-generator/develop/reference/classes/icalalarm.html#attach'
);
}

Expand Down
4 changes: 2 additions & 2 deletions src/calendar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ export default class ICalCalendar {
}
if (typeof prodId === 'string') {
throw new Error(
'`prodid` isn\'t formated correctly. See https://github.com/sebbo2002/ical-generator#' +
'prodidstringobject-prodid'
'`prodId` isn\'t formated correctly. See https://sebbo2002.github.io/ical-generator/develop/reference/'+
'classes/icalcalendar.html#prodid'
);
}

Expand Down
7 changes: 5 additions & 2 deletions src/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,10 @@ export default class ICalEvent {
(location && !location.title) ||
(location?.geo && (!isFinite(location.geo.lat) || !isFinite(location.geo.lon)))
) {
throw new Error('`location` isn\'t formatted correctly. See https://github.com/sebbo2002/ical-generator#locationobject-location');
throw new Error(
'`location` isn\'t formatted correctly. See https://sebbo2002.github.io/ical-generator/'+
'develop/reference/classes/icalevent.html#location'
);
}

this.data.location = location || null;
Expand Down Expand Up @@ -788,7 +791,7 @@ export default class ICalEvent {
* Set the event's organizer
*
* ```javascript
* event.organizer({
* event.organizer({
* name: 'Organizer\'s Name',
* email: 'organizer@example.com'
* });
Expand Down
7 changes: 7 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,11 @@ export {

export {
ICalDateTimeValue,
ICalRepeatingOptions,
ICalLocation,
ICalGeo,
ICalOrganizer,
ICalDescription,
ICalEventRepeatingFreq,
ICalWeekday
} from './types';
8 changes: 4 additions & 4 deletions src/tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,14 +224,14 @@ export function checkNameAndMail (attribute: string, value: string | ICalOrganiz

if (!result && typeof value === 'string') {
throw new Error(
'`' + attribute + '` isn\'t formated correctly. See https://github.com/sebbo2002/ical-generator#organizer' +
'stringobject-organizer'
'`' + attribute + '` isn\'t formated correctly. See https://sebbo2002.github.io/ical-generator/develop/'+
'reference/interfaces/icalorganizer.html'
);
}
else if (!result) {
throw new Error(
'`' + attribute + '` needs to be a valid formed string or an object. See https://github.com/sebbo2002/ical-' +
'generator#organizerstringobject-organizer'
'`' + attribute + '` needs to be a valid formed string or an object. See https://sebbo2002.github.io/'+
'ical-generator/develop/reference/interfaces/icalorganizer.html'
);
}

Expand Down
2 changes: 1 addition & 1 deletion test/alarm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ describe('ical-generator Alarm', function () {
assert.throws(function () {
// @ts-ignore
a.attach(Infinity);
}, /`attach`/);
}, /`attachment`/);
});

it('should change something', function () {
Expand Down
2 changes: 1 addition & 1 deletion test/calendar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe('ical-generator Calendar', function () {
const cal = new ICalCalendar();
assert.throws(function () {
cal.prodId('enemenemuh!');
}, /`prodid`/);
}, /`prodId`/);
});

it('should throw error when not string/object', function () {
Expand Down
13 changes: 12 additions & 1 deletion test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ import ical, {
ICalEvent,
ICalEventStatus,
ICalEventBusyStatus,
ICalEventTransparency
ICalEventTransparency,
ICalEventRepeatingFreq,
ICalWeekday
} from '../src';
import {} from '../dist/alarm';

Expand Down Expand Up @@ -82,4 +84,13 @@ describe('ical-generator Index', function() {
assert.ok(ICalEventTransparency);
});
});

describe('Type', function () {
it('should export ICalEventRepeatingFreq', function () {
assert.ok(ICalEventRepeatingFreq);
});
it('should export ICalWeekday', function () {
assert.ok(ICalWeekday);
});
});
});

0 comments on commit 2aedf55

Please sign in to comment.