Go to main content
Oracle® ZFS Storage Appliance 관리 설⁠명⁠서, 릴⁠리⁠스 OS8.6.x

인쇄 보기 종료

업데이트 날짜: 2016년 9월
 
 

워크플로우 오류 처리

워크플로우를 실행하는 중에 오류가 발견되면 예외가 발생합니다. 워크플로우 자체에서 예외가 발견되지 않거나 워크플로우에서 다른 방식으로 발견되지 않는 예외가 발생하면 워크플로우가 실패하고 예외와 관련된 정보가 사용자에게 표시됩니다. 오류를 제대로 처리하려면 예외를 발견하여 처리해야 합니다. 예를 들어, 이전 예에서 존재하지 않는 프로젝트에 공유를 만들려고 하면 발견되지 않는 예외가 발생합니다.

예 22  워크플로우 오류 처리

이 예를 수정하여 문제가 되는 오류를 발견하고 프로젝트가 존재하지 않는 경우 프로젝트를 만들 수 있습니다.

var workflow = {
	name: 'Create share',
	description: 'Creates a new share in a business unit',
	parameters: {
		name: {
			label: 'Name of new share',
			type: 'String'
		},
		unit: {
			label: 'Business unit',
			type: 'ChooseOne',
			options: [ 'development', 'finance', 'qa', 'sales' ],
			optionlabels: [ 'Development', 'Finance',
			    'Quality Assurance', 'Sales/Administrative' ],
		}
	},
	execute: function (params) {
		try {
			run('shares select ' + params.unit);
		} catch (err) {
			if (err.code != EAKSH_ENTITY_BADSELECT)
				throw (err);

			/*
			 * We haven't yet created a project that corresponds to
			 * this business unit; create it now.
			 */
			run('shares project ' + params.unit);
			run('commit');
			run('shares select ' + params.unit);
		}

		run('filesystem ' + params.name);
		run('commit');
		return ('Created new share "' + params.name + '"');
	}
};